Home  >  Article  >  Backend Development  >  php 调用另一个文件中的方法

php 调用另一个文件中的方法

WBOY
WBOYOriginal
2016-06-06 20:32:392173browse

在pageBuilder.php中写了一个方法

<code>    class pageBuilder{
        public static function buildHeader(){
        return hah
   html;     
        }
    }
</code>
<code><?php include ('pageBuilder.php');
echo pageBuilder::buildHeader();
</code></code>

为什么这样打印不出来

回复内容:

在pageBuilder.php中写了一个方法

<code>    class pageBuilder{
        public static function buildHeader(){
        return hah
   html;     
        }
    }
</code>
<code><?php include ('pageBuilder.php');
echo pageBuilder::buildHeader();
</code></code>

为什么这样打印不出来

php 调用另一个文件中的方法

这不是正常的吗? 是不是你的那个html结尾符没顶格写?

Apache/2.4.10 (Unix) PHP/5.5.26
不加引号的情况下会解析错误

<code> return “hah
   html”;  
</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn