Php saves array variables to files _ PHP Tutorial

Source: Internet
Author: User
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 );

}

?>

...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.