Deprecated: Function ereg() is deprecated in

在php5.3環境下運行,經常會出現php

 Deprecated: Function ereg() is deprecated in...和Deprecated: Function ereg_replace() is deprecated in...這些類型的報錯提示。
  其緣由在於:php5.3以上的版本不支持ereg()函數,而是使用preg_match()函數;不支持ereg_replace()函數,而使用preg_replace()函數。
  解決方法:將不支持的函數修改成支持的函數便可。
  
      例如
  if(eregi('^('value', $value)
  改成:
  if(preg_match('/value/', $value)
  
  再例如:
  $string = ereg_replace(' value', ' ', trim($string));
  改成:
  $string = preg_replace('{ value}', ' ', trim($string));
  
解決Deprecated: Assigning the return value of new by reference is deprecated in報錯函數

由於咱們如今php是5.3的緣由,在php5.3之中能夠直接用」=」,而以前由於在本地上測試都是5.3如下的php環境用的是」=&」符號。測試

在 5.3版本以後已經不容許在程序中使用」=&」符號。若是你的網站出現了Deprecated: Assigning the return value of new by reference is deprecated in 錯誤,彆着急,先定位到出錯的文件,查找下是否是在程序中使用了」=&」,發現使用了」=&」符號,去掉‘&’符號以後程序運行 正常。網站

問題:Deprecated: Function set_magic_quotes_runtime() is deprecated in
致使這個提示的緣由是在PHP5.3後此特性(set_magic_quotes_runtime())已經關閉。
並且在PHP6中已經徹底移除此特性。
你能夠註釋或者刪除掉出錯的行,或者是在set_magic_quotes_runtime()前面加@符號 .net

相關文章
相關標籤/搜索