I want to develop a permission function recently. I hope that the user will generate a PHP file corresponding to the user after selecting the set permission in the background, so that as long as the user logs on, I will load the corresponding configuration file, here we need to save the php array set by the user to the php file. Let's look at the implementation function.
| The Code is as follows: |
Copy code |
<? 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 );
}
?> |