When I access xml, there is error message like this :
当我访问xml时,会出现如下错误消息:
<ErrorMSG>Credit limit exceed. Booking cannot be proceed. </ErrorMSG></Response>
I want save the error message in log file
我想在日志文件中保存错误消息
How to save xml error message in log file?
如何在日志文件中保存xml错误消息?
Thank you
1 个解决方案
#1
0
You might want to look at file_put_contents() if you want something super quick:
如果你想要超快的东西,你可能想看看file_put_contents():
file_put_contents('<path to log file>', $stringInput, FILE_APPEND);
Where "path to log file" is the path + name of the file you want to write to, and $stringInput is the string representation of the error. FILE_APPEND is a flag so that every time you call file_put_contents(), a new line gets added to the file rather than rewriting the file.
“path to log file”是您要写入的文件的路径+名称,$ stringInput是错误的字符串表示形式。 FILE_APPEND是一个标志,因此每次调用file_put_contents()时,都会将新行添加到文件中而不是重写文件。
As an alternative, check out log5php which gives more control.
作为替代方案,请查看log5php,它可以提供更多控制权。
#1
0
You might want to look at file_put_contents() if you want something super quick:
如果你想要超快的东西,你可能想看看file_put_contents():
file_put_contents('<path to log file>', $stringInput, FILE_APPEND);
Where "path to log file" is the path + name of the file you want to write to, and $stringInput is the string representation of the error. FILE_APPEND is a flag so that every time you call file_put_contents(), a new line gets added to the file rather than rewriting the file.
“path to log file”是您要写入的文件的路径+名称,$ stringInput是错误的字符串表示形式。 FILE_APPEND是一个标志,因此每次调用file_put_contents()时,都会将新行添加到文件中而不是重写文件。
As an alternative, check out log5php which gives more control.
作为替代方案,请查看log5php,它可以提供更多控制权。