Php saves array variables to files. 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, in this way, as long as the user logs on, I will load the corresponding configuration. Recently, a permission function will be developed. I hope that the user will generate a php file corresponding to the user after selecting the configured permissions in the background, in this way, 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: |
|
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 ); } ?> |
...