最近要開發一個權限功能,我希望用戶在后臺選擇設置好的權限會生成一個與用戶對應的php文件,這樣只要用戶登錄我就加載相對應的配置文件了,這里我們需要把用戶設置的權限php數組保存到php文件中,下面我們來看實現函數:
- <?php
- function CreatePropertyArray(){
- global $IP;
- $content = '';
- $industris = array();
- $industry_tree = array();
- $content .= "<?phpn";
- //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);
- }
- ?>
新聞熱點
疑難解答