-
- function set_writeable($file_name)
- {
- if(@chmod($file_name,0555))
- {
- echo "Modify read-only attribute of index.php file successfully";
- }
- else
- {
- echo "Failed to modify the read-only attribute of the index.php file. The space provider does not support this operation!";
- }
- }
- set_writeable("index.php");
- ?>
-
Copy code
Save the above content as setread.php, then upload it to the space, and browse the address directly with the browser to set read-only.
However, after setting this read-only attribute, you will not have permission to delete index.php through ftp. If you need to delete or overwrite index.php, please use the following code to set the read and write permissions of index.php.
The following is the code to set up index.php to read and write:
-
- function set_writeable($file_name)
- {
- if(@chmod($file_name,0777))
- {
- echo "Modify index.php file read and write attributes successfully";
- }
- else
- {
- echo "Failed to modify the read and write attributes of the index.php file. The space provider does not support this operation!";
- }
- }
- set_writeable("index.php");
- ?>
-
Copy code
Save the above content as: setwrite.php, and access it through the browser to set the read and write permissions.
|