当前位置:网站首页>PHP-Log中打印各类型变量
PHP-Log中打印各类型变量
2022-04-22 05:47:00 【Xiaoshuang_Cao】
一般我们可以通过 var_export($array, true) 或者 print_r($array, true)来在Log中输出数组:
Log::notice('输出数组 ' . var_export($array, true), error)
Log::notice('输出数组 ' . var_export($array), error)

输出字符串等,直接 .拼接$变量名:
Log::warning('-------hhhhhh ---$sTitle='.$sTitle);
json_encode()–json转对象/json_decode()–对象转json
Log::warning('=====dandandan===== $sTitle='.json_encode($sTitle)); //json 转对象/数组;当第二个参数为true返回 array ,默认是false返回object
Log::warning('=====dandandan===== $sTitle='.json_decode($sTitle)); //对象/数组 转 json;成功返回 json 编码的 string ,失败返回 false
以字符串的形式,按数组的格式打印到日志:
file_put_contents($file, var_export($array,true));
file_put_contents('filename.txt', print_r($b, true));
print() — 会打印到postman。。。。。。
Log::warning('=====dandandan===== $sTitle='.print($sTitle));
var_dump()----会打印到postman。。。。。。。
Log::warning('=====dandandan===== $sTitle='.var_dump($sTitle));
版权声明
本文为[Xiaoshuang_Cao]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_41969287/article/details/109951044
边栏推荐
- 算数和逻辑操作
- PyGame simple aircraft war
- 常见面试问题 - 3(操作系统)
- Geojson file ShapeFile file batch conversion gadget
- STL函数库
- Record the pit of ad software learning
- Halcon and opencv or Halcon configuration modify the inheritance value of the included directory and Library Directory
- Rtl8367 learning note 2 - network configuration operation literacy
- auto和decltype两种类型推断方式的区别(学习笔记)
- QWebsocket通信
猜你喜欢

Geojson file ShapeFile file batch conversion gadget

The 7th Blue Bridge Cup embedded provincial competition: analog liquid level detection and alarm system "

PyGame simple aircraft war

CAN 数据帧,远程帧,错误帧,以及出错重连

STM32 study notes 4 - HC_ Commissioning record of SR04 ultrasonic ranging module

Interaction method II between STM32 single chip microcomputer and ld3320 voice module

chorme调试工具

Characteristics and usage of QT signal and slot

遍历数组、对象 父子通信props/$emit

关于常量指针、指针常量的使用--练习题(记录)
随机推荐
Installation of QT learning
常见面试问题 - 2(计算机网络)
Intel SGX初步学习理解笔记(持续更新)
Error in QT: undefined reference to ` widget:: settime()‘
The 7th Blue Bridge Cup embedded provincial competition: analog liquid level detection and alarm system "
QQueue使用介绍
opencv代码
数据/组件绑定的各种情况
指针传参传值等的几种使用实例
指针和引用的主要区别
Oracle uses C language to write custom functions
数据总线bus实现兄弟组件之间的通信
列表渲染的三种方式
halcon与opencv或者halcon配置修改包含目录、库目录继承值的问题
Access problems after setting up the local server
Single and multi-channel image contrast processing
UTF8转std:string和std:string转UTF8
Chorme debugging tool
Preliminary study on the principle of robot grasping objects
chorme调试工具