php能写class文件么,为什么PHP class文件后缀 可以不是.php

include 'PhpBeautifier.inc';//为什么这个class 是.inc 结尾呢?

$beautify = new PhpBeautifier();

$beautify -> tokenSpace = true;//put space between tokens

$beautify -> blockLine = true;//put empty lines between blocks of code (if, while etc)

$beautify -> optimize = true;//optimize strings (for now), if a double quoted string does not contain variables of special carachters transform it to a single quoted string to save parsing time

$beautify -> file( 'test.php', 'beautified.php' );

?>

https://github.com/easychen/L...

回复内容:

include 'PhpBeautifier.inc';//为什么这个class 是.inc 结尾呢?

$beautify = new PhpBeautifier();

$beautify -> tokenSpace = true;//put space between tokens

$beautify -> blockLine = true;//put empty lines between blocks of code (if, while etc)

$beautify -> optimize = true;//optimize strings (for now), if a double quoted string does not contain variables of special carachters transform it to a single quoted string to save parsing time

$beautify -> file( 'test.php', 'beautified.php' );

?>

https://github.com/easychen/L...

因为他只是标志一个文件而已,后缀你想改成任何合法的字符都可以(哪怕去掉后缀)。

PHP 在内部执行过程大概是这样:

找到文件名或路径对应的文件;

读取文件的内容;

将内容解析为 PHP 代码并执行。

所以,这和后缀是什么没太多关系,这里的后缀只是为了标识此文件的作用而已,相似的还有 XXX.tpl(模板)等

include可以包含任何类型文件,只要有权限读,比如下面这样

嗯,谢邀。前面回答都对,所以要注意include/require的安全性。

谢邀,刚看到这个问题我愣了下,include 指令用于将指定文件引入并运行(与require相同)。

require include什么类型的文本文件都可以,被引用的文件里面的内容会当做php代码执行(有

你可以require/include一个txt、html、js、css等,有的PHP木马利用这一点绕过安全工具的检测。

相关标签:php

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值