怎么生成静态页面
比方说
-
'.$row['xiaofenleiindex'].'
';
require_once('gongxiang.php');
$con = lianjie();
$result = mysql_query("SELECT * FROM tupianwenzi left join detail on tupianwenzi.xiaofenleiindex = detail.xiaofenleidetail");
while($row = mysql_fetch_array($result))
{
echo'
}
?>
mysql_close($con);
?>
这个代码 用什么方法生成静态页面 最好 最快
回复讨论(解决方案)
无解。。。生成不了
生成不了?????
我觉得 直接把 最终的网页源代码复制出来最快了啊 PHP有没有这种写法。。
在文件开始出加入
<?phpfunction callback($buffer) { file_put_contents('你需要的文件名', $buffer); return $buffer; //不需显示页面内容就 return '';}ob_start("callback");?>
function callback($buffer) {
file_put_contents('111.html', $buffer);
return $buffer; //不需显示页面内容就 return '';
}
ob_start("callback");
?>
echo'wee';
?>
这样写 不会生成111.html
function callback($buffer) {
file_put_contents('111.html', $buffer);
return $buffer; //不需显示页面内容就 return '';
}
ob_start("callback");
?>
echo'wee';
?>
这样写 不会生成11……
你得引用这个函数啊,这个自定义函数不得使用才行啊
function callback($buffer) {
file_put_contents('111.html', $buffer);
return $buffer; //不需显示页面内容就 return '';
}
ob_start("callback");
?>
echo'wee';
?>
这样写 不会生成11…… 噢,php 已被改得面目全非了。
加个参数
ob_start("callback", PHP_OUTPUT_HANDLER_START);
以前是不要的
引用 5 楼 aaa86965921aaa 的回复: function callback($buffer) {
file_put_contents('111.html', $buffer);
return $buffer; //不需显示页面内容就 return '';
}
ob_start("callback");
?>
ec……
$buffer 参数写什么 能不能写个能用的给我。。
这样就行,已通过测试
function callback($buffer) { file_put_contents('你需要的文件名', $buffer); return $buffer; //不需显示页面内容就 return '';}ob_start("callback", PHP_OUTPUT_HANDLER_START);
这样就行,已通过测试
PHP code?12345function callback($buffer) { file_put_contents('你需要的文件名', $buffer); return $buffer; //不需显示页面内容就 return '';}ob_start("callback", PHP_OUTPUT_HANDLER_START);
……
恩 但我改成
function callback($buffer) {
file_put_contents('111.html', $buffer);
return $buffer; //不需显示页面内容就 return '';
}
ob_start("callback");
?>
-
'.$row['xiaofenleiindex'].'
';
require_once('gongxiang.php');
$con = lianjie();
$result = mysql_query("SELECT * FROM tupianwenzi left join detail on tupianwenzi.xiaofenleiindex = detail.xiaofenleidetail");
while($row = mysql_fetch_array($result))
{
echo'
}
?>
mysql_close($con);
?>
又不行了
生成不了 生成不了 生成不了
function callback($buffer) {
file_put_contents('111.html', $buffer);
return $buffer; //不需显示页面内容就 return '';
}
ob_start("callback" , PHP_OUTPUT_HANDLER_START);
要说几遍才能注意到细节呢?
function callback($buffer) {
file_put_contents('111.html', $buffer);
return $buffer; //不需显示页面内容就 return '';
}
ob_start("callback", PHP_OUTPUT_HANDLER_START);
要说几遍才能注意到细节呢?
……
function callback($buffer) {
file_put_contents('111.html', $buffer);
return $buffer; //不需显示页面内容就 return '';
}
ob_start("callback",PHP_OUTPUT_HANDLER_START);
?>
-
'.$row['xiaofenleiindex'].'
';
require_once('gongxiang.php');
$con = lianjie();
$result = mysql_query("SELECT * FROM tupianwenzi left join detail on tupianwenzi.xiaofenleiindex = detail.xiaofenleidetail");
while($row = mysql_fetch_array($result))
{
echo'
}
?>
mysql_close($con);
?>
刚才又测试了一下,对于多段输出需要写作
define('CACHE_FILE', '111.html');function callback($buffer) { file_put_contents(CACHE_FILE, $buffer, FILE_APPEND); return $buffer; //不需显示页面内容就 return '';}file_put_contents(CACHE_FILE, '');ob_start("callback", PHP_OUTPUT_HANDLER_START);
当然你可用全局变量而不是常量来指定目标文件名
<?php/* Created on [2013-3-22] Author[Newton] Filename[test20.php]*/function callback($buffer) { file_put_contents('111.html', $buffer); return $buffer; //不需显示页面内容就 return '';}ob_start("callback",PHP_OUTPUT_HANDLER_START);?><div class="tpwzzs"><ul><?php//require_once('gongxiang.php');//$con = lianjie();//// $result = mysql_query("SELECT * FROM tupianwenzi left join detail on tupianwenzi.xiaofenleiindex = detail.xiaofenleidetail");//// while($row = mysql_fetch_array($result))// {$row = array('id'=>'id','tupianindex'=>'tupianindex','xiaofenleiindex'=>'xiaofenleiindex','detailindex'=>'detailindex');echo'<li><div class="tp"><a target="_blank" href="2jiyemian/2jiyemian.php?id='.$row['id'].'"><img src="/static/imghw/default1.png" data-src="'.$row['tupianindex'].'" class="lazy" .$row['tupianindex'].'" / alt="怎么生成静态页面" ></a></div><div class="detail">'.$row['xiaofenleiindex'].'</div><div class="detail1"><a target="_blank" href="2jiyemian/2jiyemian.php?id='.$row['id'].'">'.$row['detailindex'].'</a></div><div class="detailanniu"><a target="_blank" href="2jiyemian/2jiyemian.php?id='.$row['id'].'"></a></div></li>';// }?><?php //mysql_close($con); ?></ul></div><?php ob_end_flush(); ?>
<!--源码--><div class="tpwzzs"><ul><li><div class="tp"><a target="_blank" href="2jiyemian/2jiyemian.php?id=id"><img src="/static/imghw/default1.png" data-src="tupianindex" class="lazy" / alt="怎么生成静态页面" ></a></div><div class="detail">xiaofenleiindex</div><div class="detail1"><a target="_blank" href="2jiyemian/2jiyemian.php?id=id">detailindex</a></div><div class="detailanniu"><a target="_blank" href="2jiyemian/2jiyemian.php?id=id"></a></div></li></ul></div>
刚才又测试了一下,对于多段输出需要写作
PHP code?1234567define('CACHE_FILE', '111.html');function callback($buffer) { file_put_contents(CACHE_FILE, $buffer, FILE_APPEND); return $buffer; //不需显示页面内容就 retur……
你太给力了 搞定了 你好人做到底吧 怎么把这个页面的php地址都改成html
刚才又测试了一下,对于多段输出需要写作
PHP code?1234567define('CACHE_FILE', '111.html');function callback($buffer) { file_put_contents(CACHE_FILE, $buffer, FILE_APPEND); return $buffer; //不需显示页面内容就 retur……
怎么把页面的PHP改成html啊
比方说
你在
file_put_contents('111.html', $buffer);
前先执行
$buffer = preg_replace('/(href=.+?)\.php/', '$1.html', $buffer);
不过规则可能没那么简单,你想好了再说
我也是类似问题,至今无解,求大神啊

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov
