Home >php教程 >PHP源码 >php 把数组变量保存成.php文件实例

php 把数组变量保存成.php文件实例

WBOY
WBOYOriginal
2016-06-08 17:26:491206browse

在php中要把变量保存成php 文件,并且可以正常的执行,我们都会用到fopen和var_export形式来保存。

<script>ec(2);</script>

php教程 把数组变量保存成.php文件实例

 $path = './www/';
 $groupId =2;
 $fp = fopen($path . $groupId . '.abc.php','w'); 
 fputs($fp, '');
 fclose($fp);


 
 //调用或执行如果是数组和变量就
 return require($path.groupId.'abc.php');
 
 //如果可执行就在地址栏输入地址就行了
 
 
 
 /*
 
 */

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn