PHP执行过程中调试Log(2)
29. }
30.
31. function write2file($msg,$fileName)
32. {
33. $fp = @fopen($fileName, 'a');
34. if($fp==false)
35. {
36. $fp=@fopen($fileName,'w+');
37. if($fp==false)
38. {
39. if($fileName!=DEBUGFILE) {
40. echo "ERROR:: file ".$fileName." can not be created for writing";
41. exit();
42. }
43. else
44. {
45. echo " file ".$fileName." can not be created for writing";
46. return 0;
47. }
48. }
49. }
50. $lfp = flock($fp,LOCK_EX);
51. $i = 0;
52. while ($lfp == False)
53. {
54. $i++;
55. $lfp = flock($fp,LOCK_EX);
56. if ($i==10){return(0);}
57. }
58. fputs($fp,$msg);
59. flock($fp,LOCK_UN);
60. fclose($fp);
61. return 1;
62. }
相关新闻>>
- 发表评论
-
- 最新评论 更多>>