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

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

WBOY
Release: 2016-06-06 20:32:39
Original
2225 people have browsed it

在pageBuilder.php中写了一个方法

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

为什么这样打印不出来

回复内容:

在pageBuilder.php中写了一个方法

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

为什么这样打印不出来

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

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

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

<code> return “hah
   html”;  
</code>
Copy after login
Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template