|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
PHP成功的插入,删除,更新数据的时候,显然,你已经距离成功指日可待了。 1、If a method can be static, declare it static. Speed improvement is by a factor of 4.
1、假如一个函数可以声明为静态的,那末就用静态的,速度是改善的一个要素4.
2、# Avoid magic like __get, __set, __autoload
2、防止利用__get, __set, __autoload等魔术函数
3、require_once() is expensive
3、require_once()是相当昂贵的。
4、Use full paths in includes and requires, less time spent on resolving the OS paths.
4、用include和require时,尽可能用全途径,可以削减花在处理OS途径的工夫
5、If you need to find out the time when the scrīpt started executing, $_SERVER[’REQUEST_TIME’] is preferred to time()
5、假如你需求晓得一个剧本的入手下手运转工夫,用 $_SERVER[’REQUEST_TIME’]比用time()要好
6、See if you can use strncasecmp, strpbrk and stripos instead of regex
6、假如可以用strncasecmp, strpbrk and stripos就别用正则
7、preg_replace is faster than str_replace, but strtr is faster than preg_replace by a factor of 4
7、preg_replace比str_replace要快,然而strtr比preg_replace更快
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.
一些函数,好比字符串交换函数,承受数组和单个字符做为参数,而且假如你的参数列表不是很长,思索写一些冗余交换语句,每次传送一个字符,取代一行代码承受数组做为查找和交换的参数。
9、Error suppression with @ is very slow.
9、制止毛病输入符号@长短常慢的。
10、$row[’id’] is 7 times faster than $row[id]
10、、$row[’id’]比 $row[id]快7倍
11、Error messages are expensive
11、毛病信息长短常昂贵的
12、Do not use functions inside of for loop, such as for ($x=0; $x < count($array); $x) The count() function gets called each time.
12、不要在轮回外部利用函数,好比: for ($x=0; $x < count($array); $x)。count()函数在每次轮回中城市被挪用。
关于模板,你是不是在用smarty?这多是包管把最常常会见的页面缓存起来的最快的办法了。那么接下来,这就算学会啦?NO,NO,NO,还早呢,你至尽还没碰过OOP之类的吧?模板呢? |
|