日期:2014-05-17 浏览次数:20469 次
<?php return array ( 'a' => '1', 'b' => '2', 'c' => 'public', 'd' => '', 'e' => '', ); ?>
[User:root Time:07:23:08 Path:/home/liangdong/php]$ php a.php Array ( [a] => 1 [b] => 2 [c] => public [d] => [e] => ) [User:root Time:07:23:10 Path:/home/liangdong/php]$ cat a.php <?php $arr = include('b.php'); print_r($arr); ?> [User:root Time:07:23:12 Path:/home/liangdong/php]$ cat b.php <?php return array ( 'a' => '1', 'b' => '2', 'c' => 'public', 'd' => '', 'e' => '', ); ?>
------解决方案--------------------
shell不熟,估计你的需求我以后会用的,就研究了一个,
#!/bin/bash eval `cat php_data.txt |grep "=>"|tr -d " ,>\'"|xargs -I {} echo {}\;|tr "\n" " "` echo ${a} echo ${b} echo ${c} echo ${d}
------解决方案--------------------
跨语言的数据交换,需采用双方都能识别的数据结构,
否则就毫无意义
如果你示例 php 代码是被 zend 预编译过的,或是被威盾扰码过的(你不能说他就不是php文件了吧)
那你在 shell 中再如何分离出数据?