0
我有一種方法可以保持輸出html-snippet的不同功能。HTML塊中的輸出方法
function col2_article() {
CA_2Col::createOuter2Table();
CA_2Col::createInner2Table();
CA_2Col::createInnerMso2Table();
CA_2Col::createContentLeftTable();
CA_2Col::col2_content();
CA_2Col::closeContentLeftTable();
CA_2Col::createMiddleMso2Table();
CA_2Col::createContentRightTable();
CA_2Col::col2_content();
CA_2Col::closeContentRightTable();
CA_2Col::closeMso2Table();
CA_2Col::close2Table();
CA_2Col::close2Table();
}
是否可以在HTML文件中輸出此函數?
我用fwrite語句試了一下,但內容只在頁面輸出,沒有插入HTML文件。
function createHTML() {
$ca = $this->col2_article();
$ca_name = 'Test';
$myfile = fopen("files/". $ca_name .".html", "w") or die("Unable to open file!");
fwrite($myfile, $ca);
fclose($myfile);
}
而不是'.html'使用'.php'使它可以在瀏覽器上工作 –
我在瀏覽器中看到輸出,但我想創建的「Test.html」文件是空的,當我嘗試保存到Test.php文件中 – weristsam
'$ ca'中有什麼?你可以顯示'var_dump($ ca)?' –