I applied for a PHP space without a database. My current application data is stored in files, but this will have a security problem, that is, visitors can view the contents of these files through the URL. How can I protect these? What about the file contents? -PHP Chinese website Q&A-I applied for a PHP space without a database. My current application data is stored in files, but there is a security issue, that is, visitors can view the contents of these files through the URL. I How to protect the contents of these files? -PHP Chinese website Q&A
I applied for a PHP space without a database. My current application data is stored in files, but this will have a security problem, that is, visitors can view the contents of these files through the URL. How can I protect these? What about the file contents? -PHP Chinese website Q&A-I applied for a PHP space without a database. My current application data is stored in files, but there is a security issue, that is, visitors can view the contents of these files through the URL. I How to protect the contents of these files? -PHP Chinese website Q&A
Let’s take a look and learn.
建议的方式有三种:
1)如果你租用的php空间允许设置目录的http访问权限,那么设置一下即可。
2)可以对文件内容进行加密,那么即使被下载,也没有多大的价值。
3)可以将这些文件的后缀改为.php,即使用php文件存储应用信息,这样的话,访问者就无法通过http访问到
这些文件的真实内容了,当然这些文件中的内容必须是正确的php语法,而且内容要使用php语法中的隐藏语法
将信息隐藏起来,例如一个存放帐号信息的文件如下:
users.php