Forum

Yampiz Forum

Sharing let knowledge Spreaded, Reading let spirits growth, Creative let culture extended, Let us
  • 禁止廣告文
  • 知識傳播
  • 閱讀
  • 心靈成長
  • 創作
  • 文化傳承
Forum Dictionary / Programming / 網頁/網站程式 / PHP /

PHP5.3 後打算廢除 posix 正則表示方法

New Subject
Random
Previous
Next
|
PHP5.3 後打算廢除 posix 正則表示方法

PHP5.3後(set_magic_quotes_runtime(),ereg() )已經關閉。

運行 php 程序出現以下錯誤

Deprecated: Function set_magic_quotes_runtime() is deprecated

導致這個提示的原因是在PHP5.3後此特性(set_magic_quotes_runtime())已經關閉。

而且在PHP6中已經完全移除此特性。

你可以注釋或者刪除掉出錯的行,或者是在set_magic_quotes_runtime()前面加@符號。

PHP 5.3 ereg() 無法正常使用,提示「Function ereg() is deprecated Error」。問題根源是 php 中有兩種正則表示方法,一個是 posix,一個是 perl,php6 打算廢除 posix 的正則表示方法所以後來就加了個 preg_match。此問題解決辦法很簡單,在ereg前加個過濾提示信息符號即可:把 ereg() 變成 @ereg()。這樣屏蔽了提示信息,但根本問題還是沒有解決,php 在 5.2 版本以前 ereg 都使用正常,在 5.3 以後,就要用 preg_match 來代替 ereg。所以就需要變成這樣,原來: 

ereg("^[0-9]*$",$page)

變成:

preg_match("/^[0-9]*$/",$page)

特別提醒:posix 與 perl 的很明顯的表達區別就是是否加斜杠,所以與 ereg 相比,後者在正則的前後分別增加了兩個「 / 」符號,不能缺少。

Tips: 此問題在 php5.2 之前版本不會出現。

Function ereg() is deprecated in drupal-6.15\includes\file.inc on line 904

open the file.inc in a good text editor other than notepad, go to the line number 904 to see the following line. Then comment the line and in the next line type the replaced code. this will solve the instalation issues and also most of other issues related to the same issue.

Change

elseif ($depth >= $min_depth && ereg($mask, $file)) {

to

elseif ($depth >= $min_depth && mb_ereg($mask, $file)) {

mb_ereg fortunatly is not deprecated

  • Keywords : deprecated, 變成, preg_match, posix, Function, 符號, 正則, 方法, 提示, 已經關閉, other, min_depth, mb_ereg, issues, elseif, depth, 運行, 解決, 表達區別就, 簡單
0 0
2010-11-01T05:05:00+0000


  • Now, you can post comments by Facebook Account when your Yampiz account was logout or unvariable. whatever, we suggest to post comment by Yampiz Account to get more bounds to join new events of Heyxu
Comment
 
Verify

Facebook Page

QR-Code and APP Launcher

User Guide
This Webpage

In those service tabs, "Scan QRCode, in mobile device" or "Click the button, in this device" to open webpage or APP-related operations.
QRCode
  • Auto Platform
    For better browsing experience, it will auto detects your device to display webpage.
  • Bug Report
    Tell us about the idea, problem and errors you found.
  • Comodo Secure
    The sensitive data transmission adopts by SSL-2048 authenticated encryption.
  • Copyright
    © 2009 YamPiz Digital Inc. & Jaby Group. All rights reserved.
  • Revised Version
    V2.2.061
    03 Aug 2023 (GMT+8)