包含另一个文件的PHP函数 [英] Including PHP functions from another file

查看:72
本文介绍了包含另一个文件的PHP函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想访问另一个PHP文件中定义的某些函数,但是该文件也输出了我不想显示的内容。

I would like to access some functions defined in another PHP file, but that file also outputs content that I don't want to display.

有没有办法在没有运行整个文件的情况下访问函数?也许通过将该文件的输出重定向到隐藏的某个位置?

Is there any way to access the functions without "running" the whole file? Perhaps by redirecting the output from that file to somewhere hidden?

推荐答案

<?php
ob_start();
require 'filename.php';
ob_end_clean();
?>

这篇关于包含另一个文件的PHP函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆