Home > php教程 > php手册 > php将数组变量保存到文件

php将数组变量保存到文件

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 09:47:18
Original
1140 people have browsed it

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

 代码如下 复制代码

function CreatePropertyArray(){
    global $IP;
 
    $content       = '';
    $industris     = array();
    $industry_tree = array();
 
    $content .= "  
    //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);
 
}
 
?>
source:php.cn
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template