PHP技巧 优化动态网页技术 PHP程序的8条方法
发布时间:2022-11-19 10:43:21 所属栏目:PHP 来源:
导读: PHP技巧 优化动态网页技术 PHP程序的8条方法:
1、如果一个函数可以声明为静态的,那么就用静态的,速度是改进的一个因素4。
2、# Avoid magic like __get, __set, __autoload
3、requ
1、如果一个函数可以声明为静态的,那么就用静态的,速度是改进的一个因素4。
2、# Avoid magic like __get, __set, __autoload
3、requ
|
PHP技巧 优化动态网页技术 PHP程序的8条方法: 1、如果一个函数可以声明为静态的,那么就用静态的,速度是改进的一个因素4。 2、# Avoid magic like __get, __set, __autoload 3、require_once() is expensive 4、Use full paths in includes and requires, less time spent on resolving the OS paths 5、If you need to find out the time when the scrīpt started executing, $_SERVER[’REQUEST_TIME’] is preferred to time() 6、See if you can use strncasecmp, strpbrk and stripos instead of regex 7、preg_replace is faster than str_replace, but strtr is faster than preg_replace by a factor of 4 8、If the function, such as string replacement function, accepts both arrays and single characters as arguments, and if your argument list is not too long, consider writing a few redundant replacement statements, passing one character at a time, instead of one line of code that accepts arrays as search and replace arguments. 一些函数,比如字符串替换函数,接受数组和单个字符做为参数,并且如果你的参数列表不是很长,考虑写一些冗余替换语句,每次传送一个字符,代替一行代码接受数组做为查找和替换的参数。 (编辑:草根网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐

浙公网安备 33038102330553号