我正在使用 PHP 包括:
<?php 包括 'file1.php'; ?>
我只想包含 file1.php 的前几行 - 这可能吗?
最佳答案
如果你真的想要include
(作为PHP运行),那么只需将这些行拉到一个新文件中:
new.php:
<?php
// line 1
// line 2
并将其包含在两个文件中:
existing.php 和 other.php:
<?php
include('new.php');
...
关于PHP 包含文件但只有前几行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18866645/