function.php

来自「smarty+AJAX实例」· PHP 代码 · 共 29 行

PHP
29
字号
<?
require('./libs/Smarty.class.php');
class Smarty_Site extends Smarty {  //定义类,引用Smarty.class.php

function MakeHtmlFile($file_name, $content) 
    {     //目录不存在就创建 
         if (!file_exists (dirname($file_name))) { 
             if (!@mkdir (dirname($file_name), 0777)) { 
                     die($file_name."目录创建失败!"); 
             } 
         } 
                     
         if(!$fp = fopen($file_name, "w")){ 
             echo "文件打开失败!"; 
             return false; 
         } 


         if(!fwrite($fp, $content)){ 
             echo "文件写入失败!"; 
             fclose($fp); 
             return false; 
         } 
         
         fclose($fp);
             chmod($file_name,0666);
     } 
	}
?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?