標籤:ica com target span ini table notice oca error:
1. Deprecated: Assigning the return value of new by reference is deprecated in /usr/local/www/uugui/cake/libs/object.php on line 117
將$dispatcher =& new Dispatcher();這樣的文法改成$dispatcher = new Dispatcher();
2. Strict Standards: Non-static method DboFactory::getInstance() should not be called statically in /usr/local/www/uugui/app/common/public.inc.php on line 115
這是php調用靜態方法的文法。
將$db = DboFactory::getInstance($config);這樣的文法改成 $dboFactory = new DboFactory();$db = $dboFactory->getInstance($config); 或者將方法改成靜態(static修飾)
3. Deprecated: Function ereg() is deprecated in /usr/local/www/uugui/app/common/ipcheck.php on line 309
ereg是php匹配Regex的方法,將其替換為preg_match,並在原Regex的首尾添加/
將ereg方法用preg_match替換,$pattern = "^{$v}.*$";if(ereg($pattern,$tablename)) return "internal";改成$pattern = "/^{$v}.*$/";if(preg_match($pattern,$tablename)) return "internal";
4. Fatal error: Call-time pass-by-reference has been removed in /usr/local/www/uugui/app/models/diagram.php on line 291
將array_unshift (&$res,array("time"=>date("Y-m-d H:i:s",$curSec),"val"=>0)) ;改成array_unshift ($res,array("time"=>date("Y-m-d H:i:s",$curSec),"val"=>0)) ;
被調用的方法的參數列表含有&$,將&$替換為$
5. Notice: Undefined variable: string2 in C:\Inetpub\wwwroot\index.php on line 28
變數未定義或者初始化造成的錯誤
6. Warning: strftime(): It is not safe to rely on the system‘s timezone settings.
在php頭部添加方法date_default_timezone_set("PRC");
這些文法問題都可以通過設定php的報錯等級將其屏蔽,php設定debug等級的方法可以是php.ini(此方法作用於全域),也可以是在php頭部設定error_reporting()這個方法只對當前指令碼有效,web工程中index頁面中如用了此方法會將php.ini設定覆蓋。php.ini還可以設定屏蔽所有debug,配置選項可參看http://php.net/manual/zh/ini.php
php5.3之前版本升級至5.3以及更高版本後部分文法簡單歸納