问题描述
警告是:
PHP注意:数组到字符串的转换
当遇到数组而不是字符串时,implode函数会替换Array,这就足够了我。所以,函数的输出是我想要的。我只是希望它不要在error.log中发出警告信息。
如何抑制它?
详情:
以
为例,当我运行以下代码时:
The warning is:
PHP Notice: Array to string conversion
When encountering an array instead of a string, implode function replaces "Array" and this is enough for me. So, the output of the function is as I want. I just want it not to issue a warning message in error.log.
How to suppress it?
details:
as an example when i run the following code:
#!/usr/bin/php
<?php
$ar = array(0, array(0, 1), 1);
$str = implode(', ', $ar);
error_log($str);
?>
i获得以下输出:
i get the following output:
PHP Notice: Array to string conversion in /home/behnama/test/php/implode.php on line 5
0, Array, 1
我的问题是:我如何在输出结果正如我所期望的那样抑制错误信息?
我尝试过的事情:
我到处搜索它并发现没有任何线索。
my question again is: how can i suppress the error message while the output is as i expect?
What I have tried:
I searched for it everywhere and found no clue.
推荐答案
这篇关于如何支持PHP警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!