Hi all I have the ChromePhp logging extension set up with PhpConsole and it's working fine.

大家好我已经使用PhpConsole设置了ChromePhp日志记录扩展,它运行正常。

But the usual ChromePhp::log("Variable value: ".$variable) doesn't like having $variable as an array. It throws an array to string conversion error.

但通常的ChromePhp :: log(“变量值:”。$ variable)不喜欢将$ variable作为数组。它会将数组抛出到字符串转换错误。

Is there an in-built method to log the array in human readable format, just like javascript's console.log(array). Or is it a case of iterating over the array and passing each index and value.

是否有一种内置方法以人类可读的格式记录数组,就像javascript的console.log(数组)一样。或者是迭代数组并传递每个索引和值的情况。

1 个解决方案

#1


2

Ah easy sorry I got it. I just need to split it into two logs.

很抱歉,我明白了。我只需要将它分成两个日志。

ChromePhp::log("Array contents: ");
ChromePhp::log($array);

This prints to the console as expected in human readable format.

这将按照人类可读的格式打印到控制台。

You cant concatenate an array onto a string in the logger.

您无法将数组连接到记录器中的字符串。

更多相关文章

  1. PHP用空格分割文本为数组的方法
  2. 几个有用的php字符串过滤,转换函数代码
  3. 在数组中计数,其中值为0
  4. 如何将PHP数组的关联数组转移到javascript?
  5. PHP - 将字符串转换为键值数组
  6. 使用mod_rewrite将文件夹转换为查询字符串
  7. 计算字符串的MD5哈希值
  8. 如何在不更改其键值的情况下删除数组的第一个元素?
  9. 有一种防弹的方法可以检测php字符串中的base64编码吗?

随机推荐

  1. UNIX-LINUX编程实践教程->第八章->实例代
  2. 在linux mint x x64上安装xv6
  3. 在linux操作系统下,进行j2ee的web开发,是怎
  4. DB2 v8.1 for Linux无法安装!求助!
  5. [置顶] linux下Redis服务器部署过
  6. shell用户配置详解及bash命令参数
  7. Linux - 模块编程初试
  8. linux下sqlite3可视化工具
  9. linux下安装redis和启动redis
  10. redis 在 Linux下的安装