Php setting index. php file to read-only method-php Tutorial

Source: Internet
Author: User
Php sets the index. php file to read-only

  1. Function set_writeable ($ file_name)
  2. {
  3. If (@ chmod ($ file_name, 0555 ))
  4. {
  5. Echo "the read-only attribute of the index. php file has been modified ";
  6. }
  7. Else
  8. {
  9. Echo "an error occurred while modifying the read-only attribute of the index. php file. the space provider does not support this operation! ";
  10. }
  11. }
  12. Set_writeable ("index. php ");
  13. ?>

Save the preceding content as setread. php and then upload it to the space. you can directly view the address in the browser to set read-only. However, after setting this read-only attribute, you do not have the permission to delete index. php through ftp. if you need to delete or overwrite index. php, use the following code to set the read and write permissions for index. php. The following code sets index. php to read and write data:

  1. Function set_writeable ($ file_name)
  2. {
  3. If (@ chmod ($ file_name, 0777 ))
  4. {
  5. Echo "the index. php file read/write attribute is successfully modified ";
  6. }
  7. Else
  8. {
  9. Echo "an error occurred while modifying the index. php file read/write attribute. the space provider does not support this operation! ";
  10. }
  11. }
  12. Set_writeable ("index. php ");
  13. ?>

Save the preceding content as setwrite. php. you can set the read and write permissions by accessing the browser.

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.