What is an .inc and why use it?

后端 未结 8 682
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 21:49

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?

相关标签:
8条回答
  • 2020-11-28 22:23

    Note that You can configure Apache so that all files With .inc extension are forbidden to be retrieved by visiting URL directly.

    see link:https://serverfault.com/questions/22577/how-to-deny-the-web-access-to-some-files

    0 讨论(0)
  • 2020-11-28 22:29

    In my opinion, these were used as a way to quickly find include files when developing. Really these have been made obsolete with conventions and framework designs.

    0 讨论(0)
  • 2020-11-28 22:32

    Just to add. Another disadvantage would be, .inc files are not recognized by IDE thus, you could not take advantage of auto-complete or code prediction features.

    0 讨论(0)
  • 2020-11-28 22:36

    It's just a way for the developer to be able to easily identify files which are meant to be used as includes. It's a popular convention. It does not have any special meaning to PHP, and won't change the behaviour of PHP or the script itself.

    0 讨论(0)
  • 2020-11-28 22:42

    This is a convention that programmer usually use to identify different file names for include files. So that if the other developers is working on their code, he can easily identify why this file is there and what is purpose of this file by just seeing the name of the file.

    0 讨论(0)
  • 2020-11-28 22:46

    Generally means that its a file that needs to be included and does not make standalone script in itself.

    This is a convention not a programming technique.

    Although if your web server is not configured properly it could expose files with extensions like .inc.

    0 讨论(0)
提交回复
热议问题