posts - 88, comments - 3, trackbacks - 0, articles - 0
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

Use PHP var_export API to dump data to file

Posted on 2012-04-10 10:54 Milo的海域 阅读(358) 评论(0)  编辑  收藏 所属分类: PHP
Some time we may not want export complex hash to console but file, we can do like this to dump to file by var_export
<?php

$a = array('abc'=>"123");

# var dump
var_dump($a);

# var_export
echo var_export($a);

# export to file
$b = var_export($a, true);
error_log($b."\n", 3, "/tmp/ymiao.log");  

Result:
cat /tmp/ymiao.log
array (
  'abc' 
=> '123',
)


只有注册用户登录后才能发表评论。


网站导航: