久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使所有 PHP 文件輸出通過“過濾文件"在顯示之

Making all PHP file output pass through a quot;filter filequot; before being displayed(使所有 PHP 文件輸出通過“過濾文件在顯示之前)
本文介紹了使所有 PHP 文件輸出通過“過濾文件"在顯示之前的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

有沒有辦法讓我的所有 PHP 和/或 HTML 文件輸出在顯示在瀏覽器中之前被過濾"?我想我可以在它顯示之前通過一個全局函數傳遞它,但我被困在實現上.請幫忙.

Is there any way for all my PHP and/or HTML file output to be "filtered" before being displayed in the browser? I figured that I could pass it through a global function before it is displayed but I'm stuck on the implementation. Please help.

如果有更好的方法來實現相同的結果,我很樂意知道.

If there is a better way to achieve the same result, I'd be happy to know.

謝謝.

推薦答案

查看 ob_start 它可以讓您通過用于后處理腳本輸出的回調處理程序.

Check out ob_start which lets you pass a callback handler for post-processing your script output.

例如,PHP 包含一個內置回調 ob_gzhandler 用于壓縮輸出:

For example, PHP includes a built-in callback ob_gzhandler for use in compressing the output:

<?php

ob_start("ob_gzhandler");

?>
<html>
<body>
<p>This should be a compressed page.</p>
</html>
<body>

這是一個更完整的示例,說明如何使用 tidy 擴展:

Here's a fuller example illustrating how you might tidy your HTML with the tidy extension:

function tidyhtml($input)
{
    $config = array(
           'indent'         => true,
           'output-xhtml'   => true,
           'wrap'           => 200);

    $tidy = new tidy;
    $tidy->parseString($input, $config, 'utf8');
    $tidy->cleanRepair();

    // Output
    return $tidy;
}

ob_start("tidyhtml");

//now output your ugly HTML

如果您想確保所有 PHP 腳本使用相同的過濾器而不直接包含它,請查看 auto_prepend_file 配置指令.

If you wanted to ensure all your PHP scripts used the same filter without including it directly, check out the auto_prepend_file configuration directive.

這篇關于使所有 PHP 文件輸出通過“過濾文件"在顯示之前的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Add programmatically a downloadable file to Woocommerce products(以編程方式將可下載文件添加到 Woocommerce 產品)
Get today#39;s total orders count for each product in Woocommerce(獲取今天 Woocommerce 中每種產品的總訂單數)
Add Custom registration fields in WooCommerce and phone field validation issue(在 WooCommerce 和電話字段驗證問題中添加自定義注冊字段)
Add a select field that will change price in Woocommerce simple products(在 Woocommerce 簡單產品中添加一個將更改價格的選擇字段)
Add custom columns to admin products list in WooCommerce 3(在 WooCommerce 3 中將自定義列添加到管理產品列表)
Customizing checkout quot;Place Orderquot; button output html(自定義結帳“下訂單按鈕輸出html)
主站蜘蛛池模板: 日皮视频在线观看 | 在线观看黄色小视频 | 国产精品美女在线 | 日本一级大毛片a一 | 黄色大片av | 黄色大片在线播放 | 国产精品视频网 | 婷婷久 | 国内自拍一区 | av一二三| 一区二区自拍 | 午夜网站在线观看 | 四虎4hu永久免费网站影院 | 可以免费看黄色的网站 | 成人在线免费视频观看 | 成人伊人网 | 亚洲福利专区 | 欧美激情综合网 | 天天燥日日燥 | 国产一级黄 | 成人免费看 | 99xav| 在线日韩一区 | 狠狠操天天干 | 午夜视频在线免费观看 | 91视频在线| 色77777| 久久观看 | 亚洲精品911 | 一区视频在线 | 三级黄色片 | 精品国产三级 | av大全在线观看 | 免费国产网站 | 午夜欧美 | 日韩中文在线观看 | 亚洲黄色成人 | 国产美女91呻吟求 | 久久精品一区二区国产 | 免费黄色一级 | 亚洲五月婷婷 |