当mkdir返回false时,我目前在CakePHP 1.3.10(使用PHP 5.2.17)中使用以下代码:
CakeLog::write('error', "An error occurred while creating the \"$target_dir\" directory.");
我还想捕获确切的错误消息,例如:
Warning (2): mkdir() [function.mkdir]: File exists
然后,我可以在日志中包含该错误消息。我该如何使用CakePHP?我试过使用
error_get_last
函数,但是它只是说:Non-static method Configure::getInstance() should not be called statically, assuming $this from incompatible context
任何帮助,将不胜感激。
最佳答案
您实际上是在试图发出警告。一种方法是answered here
函数file_exists()也会检查目录是否存在。你可以尝试一下