ini_set('error_reporting', E_ALL);
| Constant | Description | Note |
|---|---|---|
| E_NOTICE | Run-time notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script. | |
| E_STRICT | Enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code. | Since PHP 5 but not included in E_ALL until PHP 5.4.0 |
| E_ALL | All errors and warnings, as supported, except of level E_STRICT prior to PHP 5.4.0. |
ini_set('error_reporting', E_ALL);
ini_set('track_errors', '1');
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
DIRECTORY_SEPARATOR
DIRECTORY_SEPARATOR是php的內部常量,用於顯示系統分隔符的命令,不需要任何定義與包含即可直接使用。在windows下路徑分隔符是\(當然/在部分系統上也是可以正常運行的),在linux上路徑的分隔符是/,這就導致了一個問題,比如伺服器是windows,有一個圖片上傳程序,伺服器上指定的上傳文件保存目錄是define('ROOT', dirname(__FILE__)."/upload");
於是php引入了DIRECTORY_SEPARATOR變量,可以將上面的寫法改寫为:
沒有留言:
張貼留言