php的小疑点

WBOY
Release: 2016-06-13 12:53:32
Original
807 people have browsed it

php的小问题
ignore_user_abort();

set_time_limit(0);
$interval =1;
do{
  phpcode;
  if{

     }
   else{

    phpcode;
   }
    sleep($interval);
  }while(true);
    
    这里的phpcode是同一段代码。但是我又不想写那么多代码。特别繁杂。
   有没有办法可以让phpcode重新调用。
     我目前就觉得用函数吧phpcode写成一个函数,然后多次调用。 
    还有其他 方法吗???  
    第二个问题就是phpcode部分
    这里,我phpcode的功能是在建立目录写入文件。  
     例如 在文件夹 1/  写入 1-10000.html
      但是在写入的过程中。出现了问题就是卡死.比如在生成的过程中删除1这个目录结果就出现了卡死现象。球解决办法


------解决方案--------------------
问题1....
果断写成一个函数
PS: 您意思 是想 不用 do while 来 执行第一次么?
直接用while 吧?
------解决方案--------------------
phpcode写成一个函数比较好,卡死现象需要优化这个函数了,用缓存写文件
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!