PHP
(重定向自Php)
代码片断
参见主条目PHP代码片断。
$_SERVER 变量
- $_SERVER['REMOTE_ADDR']
- 用户IP
- $_SERVER['REMOTE_PORT']
浏览器识别
get_browser() 函数可以用来进行浏览器识别,适用于 PHP4, 5。需要browscap.ini文件。
mixed get_browser([string $user_agent[, bool $return_array = false]])
设置返回数组时返回结果类似于:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3
Array
(
[browser_name_regex] => ^mozilla/5\.0 (windows; .; windows nt 5\.1; .*rv:.*) gecko/.* firefox/0\.9.*$
[browser_name_pattern] => Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:*) Gecko/* Firefox/0.9*
[parent] => Firefox 0.9
[platform] => WinXP
[browser] => Firefox
[version] => 0.9
[majorver] => 0
[minorver] => 9
[cssversion] => 2
[frames] => 1
[iframes] => 1
[tables] => 1
[cookies] => 1
[backgroundsounds] =>
[vbscript] =>
[javascript] => 1
[javaapplets] => 1
[activexcontrols] =>
[cdf] =>
[aol] =>
[beta] => 1
[win16] =>
[crawler] =>
[stripper] =>
[wap] =>
[netclr] =>
)
参见:
另见xbd。
配置
opcache
PHP 5.5.0+ 直接启用即可[1]:
zend_extension=opcache.so
查看状态,可以使用 opcache-status。
参见
外部链接
- PHP 教程 - PHP 完全中文手册
- 明城:一些被忽视的 PHP 函数(整理)
- PHP: a fractal of bad design - fuzzy notepad
- PHP Sucks, But We Can Only Rant, Not Avoid It | iface thoughts(文章开头还包含另外几篇批评 PHP 和一篇赞扬之的文章链接)
- www.phpwtf.org已失效,存档
- PHP Manual Masterpieces
- PHP 5.4 内置web服务器
- PHP: The Good Parts (一篇文章也没有)
- 如何正确发布PHP代码 | 火丁笔记
- 谈谈PHP的Reload操作 | 火丁笔记 (php-fpm 没有真正的平滑重启功能)
- Content Injection Vulnerability in WordPress 4.7 and 4.7.1: WordPress 中由于设计失误和类型转换导致的严重安全漏洞
- adsr/phpspy: Low-overhead sampling profiler for PHP 7