1. 程式人生 > >PHP:錯誤 Deprecated: Function split() is deprecated in ... 解決辦法

PHP:錯誤 Deprecated: Function split() is deprecated in ... 解決辦法

本地測試的程式上傳到伺服器出現很多錯誤,Deprecated: Function split() is deprecated  
查了原因是因為PHP的版本不同所導致的,本身程式開發的時候用的是PHP5.2以下版本,而現在空間上用的是PHP5.3的版本,很多PHP函式已經過時不能用了,這裡的這個錯誤原因就是函式split()在 PHP5.3 中已經不建議使用了。

PHP5.3 split() 不建議使用的原因:
PHP 5.3.0 之後的regex, 希望使用PCRE 的規格, POSIX Regex 都不建議使用了(統一Regex, 避免規格太多?).

所以下述是不建議使用的Function (POSIX), 與建議替換成的Function (PCRE) 列表, 詳可見: 

PHP: Differences from POSIX regex


* POSIX → PCRE
* ereg_replace() → preg_replace()
* ereg() → preg_match()
* eregi_replace() → preg_replace()
* eregi() → preg_match()
* split() → preg_split()
* spliti() → preg_split()
* sql_regcase() → No equivalent
PHP split() 替代方案
* 需要regex 的split, 可用preg_split() 代替
* 不需要regex, 只要要快速分割固定的字串, 可用
explode()
 代替. (速度會比需要regex 的快很多)

相關推薦

PHP錯誤 Deprecated: Function split() is deprecated in ... 解決辦法

本地測試的程式上傳到伺服器出現很多錯誤,Deprecated: Function split() is deprecated  查了原因是因為PHP的版本不同所導致的,本身程式開發的時候用的是PHP5.2以下版本,而現在空間上用的是PHP5.3的版本,很多PHP函式已經過時不

PHP Deprecated: Function ereg_replace() is deprecated in解決方法

這個問題是因為你用的php版本過高,在php5.3中,正則函式ereg_replace已經廢棄,而dedecms還繼續用,有兩個方案可以解決以上問題:1、把php版本換到v5.3下。2、繼續使用v5.3,修改php.ini檔案;extension=php_mbstring.dll改為extension=php

織夢安裝後提示Function ereg_replace() is deprecated解決方法

織夢 安裝 strong min dede onf replace 提示 function 織夢 dedecms v5.6 安裝後提示 Deprecated: Function ereg_replace() is deprecated in D:\www\dede\conf

【我的Android進階之旅】Android 7.0報異常java.lang.SecurityException: COLUMN_LOCAL_FILENAME is deprecated;

之前開發的一個和第三方合作的apk,在之前公司的 Android 5.1 系統的手錶上執行正常,今天在公司新開發的 Android 7.1系統的手錶上執行的時候,使用 DownloadManager 下載之後,查詢下載狀態的時候,報了異常 java.lan

tensorflow錯誤 InternalError: Dst tensor is not initialized

電腦環境 GPU:GTX1060/6G 系統:ubuntu14.04 python2.7 tensorflow1.4.0 cuda8.0 cudnn6.0   在跑https://github.com/MarvinTeichmann/KittiSeg.git

遠程桌面,身份驗證錯誤要求的函數不正確等解決辦法

做的 arc 控制面板 遠程連接 重命名 online 復制代碼 rac oca indows版本10.0.17134,安裝最新補丁後無法遠程windows server 2008、2013、2016服務器 報錯信息如下:出現身份驗證錯誤,要求的函數不受支持 可能是由於C

IIS 部署專案時提示錯誤訊息401.2 未經授權伺服器配置導致登陸失敗。” 的解決辦法

IIS 部署專案時提示:“錯誤訊息401.2 :未經授權:伺服器配置導致登陸失敗。” 的解決辦法? 這個錯誤的定位:你的站點使用了Forms驗證,而且在部署在生產環境的時候,設定錯誤,或者註釋了。 解決辦法: 1、檢查Forms配置是否遮蔽。 2、有許可權訪問的資源是否已經開發。

使用setuptools和cython打包python程式的時候遇到Microsoft visual c++ 14.0 is required問題解決辦法

1. 然而按照提示安裝Microsoft Visual C++ 14.0依然不行。https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads。(坑啊) 2.最後找到這個連結htt

parser.parse is not a function——arcgis api報錯解決辦法

在使用arcgis api的時候,會出現上面這種錯誤,百思不得其解,最後找到解決辦法。 出現這個錯誤的原因是因為你引用的順序和你在function裡面的順序不同造成的,dojo require 要

伺服器錯誤http 錯誤500.19 Internal Server Error 的解決辦法

釋出牛腩新聞系統的時候遇到一個很頭疼的錯誤: 網上查了一些相關資料,大部分都說原因是asp.net的framework版本問題。因此照著說的也重新註冊了一下。 網上一般的資料都是說註冊2.0版本,但是這個需要根據自己的程式來,我用的是V4.0的,所以註冊的時候就應註冊成這

PHPFatal error: Class 'COM' not found in … 的解決辦法

1.檢查php目錄ext資料夾下面php_com_dotnet.dll是否存在 2.在php.ini裡面加入以下語句:     [PHP_COM_DOTNET]     extension=php_com_dotnet.dll     如圖所示:     3.php.in

javascript報錯ReferenceError: $ is not defined解決辦法

js報錯:ReferenceError: $ is not defined。 在執行重新整理專案介面時,通過瀏覽器控制檯發現錯誤ReferenceError: $ is not defined,如下圖所示: 部分介面程式碼如下: 解決方法: 我們不難發現script位置有問題,因

Rails錯誤LoadError: no such file to load – openssl 解決辦法

Install openssl and openssl-devel. aptitude install libssl-dev Go to your Ruby source directory and run the following commands: cd ext/openssl rvmsudo r

Git clone 報錯fatal: protocol 'https' is not supported解決辦法

Cloning into '2_mqtt_test_onenet'... fatal: protocol 'https' is not supported 解決辦法: 方法1:不用https,換用ssh去clone(如果有ssh選項) 如:git clone

NFS無法掛載,出現錯誤reason given by server: Permission denied的解決辦法

The ANSWER: The problem was that the special nfsd file system that mounts to /proc/fs/nfsd wasn't mounted. I'm not sure how it gets moun

執行Hbase命令遇到了錯誤 regionserver running as process ×××. Stop it first.解決辦法

問題:執行./start-hbase.sh命令 出現:master running as process 4615. Stop it first.錯誤。 解決辦法:檢視配置檔案hbase-site.x

關於Xcode6編譯變更 “Implicit declaration of function 'sysctl' is invalid in C99” 報錯問題

  之前程式碼在Xcode5.1上面跑的好好的,但是自從升級到6.0之後,就經常出現編譯報錯問題。後來查閱的相關資料,好像是Xcode為了相容Swift語言,更換來編譯系統(名字忘記了)。於是就報了一個C語言的C99編譯錯誤,不說了,直接上程式碼。 一般出現該問題是因

百度地圖230錯誤 APP Scode校驗失敗問題解決辦法

        因為我們在之前百度開放平臺上建立應用的時候要生成一個AK,然後這個AK=sha1 + 包名的之後得到的。而這個sha1又有兩種方式生成:一種是在cmd中按照文件的方式生成,另一種是通過ecplice中的 window - preferences -android - build 你就能看見那

pip安裝wordcloud報錯Microsoft Visual C++ 14.0 is required. 的解決辦法

pip install wordcloud報錯:error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.vi

Linuxmount命令出現Host is down如何解決

導讀 當使用Linux中的mount命令掛載一個Windows的共享目錄的時候有時會出現: mou