PHP包含文件扩展名? [英] PHP include file extensions?

查看:141
本文介绍了PHP包含文件扩展名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于PHP中的必需/包含文件,最好使用 .inc 扩展名与 .inc.php vs .php extensions?

For required/included files in PHP, is it better to use .inc extensions vs .inc.php vs .php extensions?

推荐答案

有时人们使用 .inc 扩展然后进行一些服务器配置以保持 .inc 文件通过Web浏览器访问。如果知识渊博的系统管理员完全正确地完成了这个可能,但是有一个更好的方法:任何不应该由Web用户访问的文件都应该保存在文档根目录之外。一旦这些文件不在网络上,可以这么说,你可以使用你想要的任何扩展名。 .php 绝对是语法高亮,一般理智等的明智选择。

Sometimes people use the .inc extension and then do some server configuration to keep .inc files from being accessed via a web browser. This might be good, if done absolutely correctly by a knowledgeable sysadmin, but there's a better way: Any file that's not supposed to be accessed by web users should be kept outside your document root. Once these files are off the web, so to speak, you can use whatever extension you want. .php is definitely a sensible choice for syntax highlighting, general sanity, and so on.

这篇关于PHP包含文件扩展名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆