[英]Redirection on direct access to PHP script
I'm building a website that contains a considerable amount of object-oriented PHP code. 我正在构建一个包含大量面向对象的PHP代码的网站。 To keep the code clean, each class is stored in a single file named
[classname].class.php
and require_once
'd in the script file. 为了保持代码清洁,每个类都存储在脚本文件中名为
[classname].class.php
和require_once
的单个文件中。 Being a form evaluation script, it already has redirections based on the POST variable to prevent dummy execution and database errors. 作为表单评估脚本,它已经具有基于POST变量的重定向,以防止虚拟执行和数据库错误。
How do I make it so anyone trying to access the .class.php
files gets redirected to the related HTML page, but keep it usable by include
and require
? 我怎么做到这一点,所以任何试图访问
.class.php
文件的人都被重定向到相关的HTML页面,但是通过include
和require
让它可用?
you can either 你也可以
If you need further explanation on any of these, just ask. 如果您需要进一步解释这些,请询问。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.