php將數(shù)組變量保存到文件
來(lái)源:程序員人生 發(fā)布時(shí)間:2014-01-21 18:35:43 閱讀次數(shù):3373次
最近要開發(fā)一個(gè)權(quán)限功能,我希望用戶在后臺(tái)選擇設(shè)置好的權(quán)限會(huì)生成一個(gè)與用戶對(duì)應(yīng)的php文件,這樣只要用戶登錄我就加載相對(duì)應(yīng)的配置文件了,這里我們需要把用戶設(shè)置的權(quán)限php數(shù)組保存到php文件中,下面我們來(lái)看實(shí)現(xiàn)函數(shù):
- <?php
- function CreatePropertyArray(){
- global $IP;
-
- $content = '';
- $industris = array();
- $industry_tree = array();
-
- $content .= "<?phpn";
-
-
- $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);
-
- }
- ?>
生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對(duì)您的學(xué)習(xí)有所幫助,可以手機(jī)掃描二維碼進(jìn)行捐贈(zèng)