-2
我有這樣的代碼,它工作在PHP 5.2如何使其在PHP 5.3.3工作
if (realpath (__FILE__) == realpath ((isset ($_SERVER ['PATH_TRANSLATED']) ? $_SERVER ['PATH_TRANSLATED'] : $_SERVER ['ORIG_PATH_TRANSLATED']))) {
$path_parts = pathinfo (__FILE__);
trigger_error ('Direct call of file' . $path_parts ['basename'], E_USER_ERROR);
}
但在5.3.3我有錯誤:
PHP Notice: Undefined index: ORIG_PATH_TRANSLATED in /var/www/user/data/www/site/plugins/system/u24_je_plg_lytebox.php on line 16
應該如何改變了嗎? 謝謝!
您可能會在5.2中觸發相同的通知(**不**錯誤),但在兩臺服務器上有不同的'error_reporting'設置。 – ceejayoz 2013-02-20 16:44:44
http://php.net/manual/en/reserved.variables.server.php對變更有解釋 – piddl0r 2013-02-20 16:46:14