什么是.inc,为什么使用它? [英] What is an .inc and why use it?

查看:100
本文介绍了什么是.inc,为什么使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常在PHP中看到包含include.inc文件的示例. .inc是什么意思?它的作用是什么?使用它的缺点和优点是什么?

I often see examples in PHP that include.inc files. What is the meaning of .inc? What it is used for? What are the disadvantages and advantages of using it?

推荐答案

它没有任何意义,它只是文件扩展名.某些人习惯将扩展名为.inc的文件命名为其他PHP文件所包含的文件,但这只是惯例.

It has no meaning, it is just a file extension. It is some people's convention to name files with a .inc extension if that file is designed to be included by other PHP files, but it is only convention.

它确实有一个可能的缺点,那就是通常不将服务器配置为将.inc文件解析为php,因此,如果该文件位于您的Web根目录中,并且您的服务器是以默认方式配置的,则用户可以查看您的php直接访问URL即可获取.inc文件中的源代码.

It does have a possible disadvantage which is that servers normally are not configured to parse .inc files as php, so if the file sits in your web root and your server is configured in the default way, a user could view your php source code in the .inc file by visiting the URL directly.

唯一的优点是可以轻松识别将哪些文件用作包含文件.尽管只是给它们一个.php扩展名并将它们放置在一个include文件夹中具有相同的效果,但没有上述缺点.

Its only possible advantage is that it is easy to identify which files are used as includes. Although simply giving them a .php extension and placing them in an includes folder has the same effect without the disadvantage mentioned above.

这篇关于什么是.inc,为什么使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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