文章目录[隐藏]
php后台查出数据,输出在html表格里。后台b.php,前台a.html。查出的数据是$result,里面有id,name。怎么做?
回复讨论(解决方案)
在线等在线等在线等在线等
b.php:
$con=mysqli_connect('localhost','root','root','test'); //用户名和密码请自己修改$a=mysqli_query($con,'select * from a'); //表名自己修改$html="<table border='1' width='100'><tr><td>id</td><td>name</td></tr>";while($rel=mysqli_fetch_assoc($a)){ $html=$html."<tr><td>{$rel['id']}</td><td>{$rel['name']}</td></tr>";}$html.'</table>';file_put_contents('a.html',$html);
b.php:
$con=mysqli_connect('localhost','root','root','test'); //用户名和密码请自己修改$a=mysqli_query($con,'select * from a'); //表名自己修改<a style="color:transparent">本@文来源gao($daima.com搞@代@#码(网5</a><strong>搞gaodaima代码</strong>$html="<table border='1' width='100'><tr><td>id</td><td>name</td></tr>";while($rel=mysqli_fetch_assoc($a)){ $html=$html."<tr><td>{$rel['id']}</td><td>{$rel['name']}</td></tr>";}$html.'</table>';file_put_contents('a.html',$html);
这个是在php文件里输出的,我想把它输出到其他html页面里
那你总得把需求说清楚吧?
那你总得把需求说清楚吧?
很简单,基本的功能。比如a.php和a.html两个文件。php查询到信息,输出到a.html页面上。
请使用模板技术
请使用模板技术
smarty不会用,难。老板也不让用thinkphp,就让直接这样写