#!/usr/bin/PHP <?PHP $mental_log_file = "/home/ali/mental-log"; array_shift($argv); //get rid of the initial arg (name of the command) $log_entry = date('j-n-y H:i') . ' ' . implode(' ',$argv) . "\n"; file_put_contents($mental_log_file,$log_entry,FILE_APPEND);
这是我几次运行得到的:
ali@oem-desktop:~$mlog blah ali@oem-desktop:~$mlog blah Segmentation fault ali@oem-desktop:~$mlog blah ali@oem-desktop:~$mlog blah Segmentation fault ali@oem-desktop:~$mlog blah ali@oem-desktop:~$mlog blah ali@oem-desktop:~$mlog blah Segmentation fault ali@oem-desktop:~$mlog blah ali@oem-desktop:~$mlog blah Segmentation fault ali@oem-desktop:~$mlog blah Segmentation fault
知道我在这里做错了什么吗?即使在产生分段错误的运行上,该文件似乎也按预期正确更新.我正在运行Ubuntu 9.04 Jaunty.
ali@oem-desktop:~$PHP --version PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 23 2009 14:37:14) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0,Copyright (c) 1998-2008 Zend Technologies
提前致谢.