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

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

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

問題描述

限時送ChatGPT賬號..

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

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.

如果有更好的方法來實現(xiàn)相同的結(jié)果,我很樂意知道.

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

謝謝.

推薦答案

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

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

例如,PHP 包含一個內(nèi)置回調(diào) 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.

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

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

相關(guān)文檔推薦

Add programmatically a downloadable file to Woocommerce products(以編程方式將可下載文件添加到 Woocommerce 產(chǎn)品)
Get today#39;s total orders count for each product in Woocommerce(獲取今天 Woocommerce 中每種產(chǎn)品的總訂單數(shù))
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 簡單產(chǎn)品中添加一個將更改價格的選擇字段)
Add custom columns to admin products list in WooCommerce 3(在 WooCommerce 3 中將自定義列添加到管理產(chǎn)品列表)
Customizing checkout quot;Place Orderquot; button output html(自定義結(jié)帳“下訂單按鈕輸出html)
主站蜘蛛池模板: 国产日韩欧美激情 | 91麻豆精品国产91久久久更新资源速度超快 | 99精品欧美一区二区三区综合在线 | 国产精品久久久久无码av | 国产精品爱久久久久久久 | 欧美一区二区三区国产 | 久久99精品久久久久久国产越南 | 亚洲欧美国产精品一区二区 | 中文字幕在线看 | 亚洲精品乱码久久久久久按摩观 | 一级毛片视频在线 | 91精品国产综合久久久久久丝袜 | 亚洲免费视频一区 | 亚洲aⅴ | 一级片在线观看 | 欧美激情在线精品一区二区三区 | 亚洲综合国产 | 欧美成年视频 | 久久久久久九九九九九九 | 国产成人福利 | 亚洲国产成人在线 | 黄色一级大片在线免费看产 | 欧美一级免费 | 欧美亚洲一区二区三区 | 天天av天天好逼 | 亚洲三级av | 久久精品国产v日韩v亚洲 | 久久久成人网 | 久草欧美| 在线播放国产一区二区三区 | www国产成人免费观看视频,深夜成人网 | 国产农村妇女毛片精品久久麻豆 | 国产一区二区影院 | 亚洲精品二区 | 欧美福利久久 | 欧美亚洲国产日韩 | 91视频久久| 在线观看免费高清av | 日韩在线精品视频 | 亚洲国产成人精品女人久久久 | 国产免费自拍 |