Last active
November 22, 2017 06:53
-
-
Save gotnix/f537fc62462e31c75044008e291015cc to your computer and use it in GitHub Desktop.
打印 $_SERVER 变量,用于检查 PHP http 的相关变量。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * 查看 opchche 的状态 | |
| * http://php.net/manual/en/ref.opcache.php opcache 的其他函数 | |
| * https://github.com/rlerdorf/opcache-status/, 这个项目的 opcache.php 脚本可以单独拿来用 | |
| * https://kx.cloudingenium.com/linux/wasted-memory-zend-opcache-memcached/ | |
| * https://kx.cloudingenium.com/technologies/wordpress/install-zend-opcache-php-wordpress/ | |
| */ | |
| $opCacheInfo = opcache_get_status(); | |
| echo '<pre>'; | |
| var_export($opCacheInfo); | |
| echo '</pre>'; | |
| echo PHP_EOL; | |
| exit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * 这个脚本是给禁用了 phpinfo() 的环境用的。更有逼格的调试方法请参考: | |
| * http://stackoverflow.com/questions/4323411/how-can-i-write-to-console-in-php[How can I write to console in PHP?] | |
| * https://paulund.co.uk/output-php-data-in-browser-console[PHP Debug In Browser Console] | |
| * https://codeinphp.github.io/post/outputting-php-to-browser-console/[Outputting PHP To Browser Console] | |
| */ | |
| echo '<br>.: Dump http server and execution environment information :.</br>'; | |
| echo '<br>----- PHP Variables: $_SERVER ------</br>'; | |
| echo '<pre>'; | |
| print_r($_SERVER); | |
| echo '</pre>'; | |
| echo '<br>------ Environment: $_ENV ------</br>'; | |
| echo '<pre>'; | |
| print_r($_ENV); | |
| echo '</pre>'; | |
| echo PHP_EOL; | |
| exit; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如果
print_r()被禁用,类似的方法还有var_dump()、var_export()。