I am developing a permission function recently. I hope that if the user selects the set permissions in the background, a php file corresponding to the user will be generated, so that as long as the user logs in, I will load the corresponding configuration file. Here we need to set the user The permission php array is saved to the php file. Let’s look at the implementation function
代码如下 | 复制代码 |
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); } ?> |