标签 php 下的文章

PHP判断访问终端是手机还是电脑

网上找了段通过PHP判断用户是手机访问还是电脑访问的代码。对比了好几种代码,最终选择了这个。备份下,以后用得着。 function is_mobile() { $user_agent = $_SERVER['HTTP_USER_AGENT']; $mobile_agents = array("240x320", "acer", "acoon", "acs-", "abacho", "ahong", "airness", "alcatel", "amoi", "android", "anywhereyougo.com", "applewebkit/525", "applewebkit/532", "asus", "audio", "au-mic&quo...

lnmp中php错误日志开启,error_log和display_errors区别

LNMP下的错误需要在/usr/local/php/etc/php-fpm.conf里设置,加上catch_workers_output = yes,错误信息就会记录到php-fpm.conf里error_log设置的文件里。或php-fpm.conf里加上php_admin_value[error_log] = /usr/local/php/var/log/php-error.logphp_admin_flag[log_errors] = on上述两种方法都行,重启php-fpm生效同理php.ini里的display_errors也是需要在php-fpm.conf里设置的,加上php_flag[display_errors] = On就开启了。有时可能错误日志文件不自动创建,可以执行:touch /usr/local/php/var/log/php-error.log && chown www:www /usr/local/php/var/log/php-error.log注意:display_errors仅用于php调试,错误信息会在前台显示,生产环境下请设...