有什麼方法可以通過include('to_include.php')
檢查包含的文件是否已返回任何內容?如何檢查include()是否返回任何內容?
這是它的外觀:
//to_include.php
echo function_that_generates_some_html_sometimes_but_not_all_the_times();
//main_document.php
include('to_include.php');
if($the_return_of_the_include != '') {
echo $do_a_little_dance_make_a_little_love_get_down_tonight;
}
我包括我的主文檔中to_include.php
所以之後我想檢查是否是由包括文件生成的任何東西。
我知道顯而易見的解決方案是在main_document.php
中只使用function_that_generates_some_html_sometimes_but_not_all_the_times()
,但在我當前的設置中這是不可能的。
你聰明*§!?&#:-) – maartenmachiels 2010-12-09 14:31:22