首页 > php数组 > php将数组变量保存到文件

php将数组变量保存到文件

最近要开发一个权限功能,我希望用户在后台选择设置好的权限会生成一个与用户对应的php文件,这样只要用户登录我就加载相对应的配置文件了,这里我们需要把用户设置的权限php数组保存到php文件中,下面我们来看实现函数:

<?php  
function CreatePropertyArray(){  
    global $IP;  
    $content       = '';  
    $industris     = array();  
    $industry_tree = array();  
    $content .= "<?php\n";  
    //Industry  
    $industries = getMasterPropertyValues('Industry');  
    foreach($industries as $v){  
        $industry_tree["$v"]= getSlavePropertyValues("Industry","Product Category", $v);  
    }  
    $content .= '$Industries = '. var_export($industries,true) . ";\n";  
    file_put_contents($IP . '/termwiki_array.php',$content,LOCK_EX);  
}

               
               

教程地址:http://www.phprm.com/shuzu/fs1173.html

欢迎转载!但请带上文章地址^^

标签:php数组 变量 文件

相关文章

发表留言