教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 把php代码保存到php文件实现方法

把php代码保存到php文件实现方法

发布时间:2016-12-03   编辑:jiaochengji.com
教程集为您提供把php代码保存到php文件实现方法等资源,欢迎您收藏本站,我们将为您提供最新的把php代码保存到php文件实现方法资源
很多时间我们需要把php生成的php代码保存到php文件里面,像如果利用到缓存时一些基础数据就直接保存到了一个指定的php缓存文件了,下面我们来看看实例。

 

<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy2368')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy2368><?fopen($strName.'.arr.php','w');
fwrite($file,ob_get_contents());
fclose($file);
ob_clean();
return true;
}
?>

实例

<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy4668')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy4668>


<?php
//存储数组
$hello=array(1=>'test',2=>array('hello123'));
cacheArr($hello);
unset($hello);
//读取数组
require 'hello.arr.php';
print_r($hello);
?>

您可能感兴趣的文章:
php读取word\pdf等文档内容保存到网页中
php做下载文件的方法
把php代码保存到php文件实现方法
php导出word文档与excel表格文件
php页面缓存的例子(减经cpu与mysql负担)
php绘图不显示图片怎么办
php接收二进制文件转换成图片的方法分享
php输入流php://input发送图片流到服务器的例子
php inc文件的风险分析
PHP CURL获取cookies模拟登录的方法介绍

[关闭]
~ ~