www-=感恩的心=-www

每天进步一点点

2012-01-12 12:59

Function eregi_replace() is deprecated

flex连接不上amfphp

 

\amfphp\core\amf\app\Gateway.php

 

line 282:

 

function setErrorHandling($level)

{

//$GLOBALS['amfphp']['errorLevel'] = $level;

 

                $GLOBALS['amfphp']['errorLevel'] = '';

}

Function eregi_replace() is deprecated 

C:\wamp\www\amfphp\core\shared\util\MethodTable.php on line 506 
是因为该方法在php5.3中被去掉了,所以会提示错误,

修改/amfphp/core/shared/util/MethodTable.php 文件:

$comment = eregi_replace("\n[ \t]+", "\n", trim($comment)); $comment = str_replace("\n", "\\n", trim($comment)); $comment = eregi_replace("[\t ]+", " ", trim($comment));

改成下面的内容。就正确了

$comment = preg_replace("#\n[ \t]+#U", "\n", trim($comment)); $comment = str_replace("\n", "\\n", trim($comment));

$comment = preg_replace("#[\t ]+#U", " ", trim($comment));

在php5.3中官方废弃了很多函数,其中目前本人收集到的有

ereg();

eregi();

ereg_replace();

eregi_replace();

set_magic_quotes_runtime();

split();

mysql_close();

解决办法

1.使用php5.2版本

2.如果一定要用php5.3,请修改php.ini中下面代码

;extension=php_mbstring.dll 修改为;  extension=php_mbstring.dll

;mbstring.func_overload = 0 修改为; mbstring.func_overload = 7

php  报错 Deprecated: Assigning the return value of new by reference is deprecated in

http://hi.baidu.com/phpahz/blog/item/302ec80174cb10c762d986d0.html

很多朋友的php程序当php的版本升级到5.3以后,会出现”Deprecated: Assigning the return value of new by reference is deprecated in“ 显示出来。这是因为5.3以后,不能使用”=&”符号,可以直接用”=”就可以了。

所以当出现这个问题后有两种解决方法:

1. 把php的版本降级到5.3以下,但后退的不是明智的选择。

2.  对程序中”=&”符号全部用”=” 代替。
 
http://www.tulongzhiji.com/php-deprecated-assigning-the-return-value-of-new-by-reference-is-deprecated-in/
昨晚用Spreadsheet_Excel_Reader导入EXCEL内容到数据库的时候,出现了以下提示:

Deprecated: Assigning the return value of new by reference is deprecated in

定位到出错的那一行:

1  $this->_ole =& new OLERead(); 

我本地环境用的是PHP/5.3.3。

下面这段话引用于因思而变

解决办法:php5.3开始后,废除了php中的”=&”符号,所以要想复制,直接用=引用即可。详细如下:

1、PHP5对象复制是采用引用的方式;
2、如果不采用引用方式,则需要在复制对象时加关键字 clone;
3、如果在复制的过程中,同时要变更某些属性,则增加函数_clone();

或是屏蔽错误

 

评论