我有一个函数log($text)
这一切所做的就是写$text
到数据库。
我想包括__LINE__
and __FILE__
,但不想像我现在那样每次都将其作为参数包含在内:
function log($text,$file = null, $line = null){
// write $text to db using the three paramters
}
如果我改变$file = null
to $file = __FILE__
它使用函数所在的文件名,而不是调用函数的位置。
有没有办法解决?
Although the question is identical, the answers seem to focus on some other topic: function name($param, $line = __LINE__, $file = __FILE__) {}; https://stackoverflow.com/questions/3387320/function-nameparam-line-line-file-file
also, not using Zend framework: how to have php get the __LINE__ or __FILE__ value where a function is called https://stackoverflow.com/questions/7184280/how-to-have-php-get-the-line-or-file-value-where-a-function-is-called?rq=1
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)