如何将一些php和html代码发送到页面然后运行它 [英] how do send some php and html code to page and then run it

查看:63
本文介绍了如何将一些php和html代码发送到页面然后运行它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨所有



我怎么能发送一些php和html(或只有php或只是html)一个页面(修复页面)并显示代码结果?



例如创建一个名为 showresult.php的修复页面




  <  !DOCTYPE     html  >  
< html >
< body >

<? php

回波 我的 first PHP script!;

>

< span class =code-keyword>< / body >
< / html >





showresult.php display

我的第一个PHP脚本!





i想要像w3schools这样简单的东西



请帮帮我



非常感谢

解决方案

如果你想在html文档中包含一个php脚本,那么你可以做这样的事情。 />


// ShowResult.php



 <?php  


var = Hello World;
?>





//yourpage.html < br $> b $ b

 <   html  >  
< head > <? php include ShowResult.php; ?> < / head >
< 正文 >

<? php echo


< BLOCKQUOTE> VAR ; ?>
< / body >
< / html >

< / html >





我在这里做的是简单地创建一个名为ShowResult.php的外部php文件,在其中我创建一个名为var的变量并为其赋值Hello World。在名为yourpage.html的html文件中,我使用phpinclude函数调用了php文件。



您可以在其他情况下应用此原则来调用html文件中的外部php脚本。看看这里获取更多帮助。


hi all

how do i can send some php and html (or only php or only html) to one page(fix page) and show code result ?

for example create a fix page with name showresult.php

when send

<!DOCTYPE html>
<html>
<body>

<?php

echo "My first PHP script!";

?>

</body>
</html>



showresult.php display

My first PHP script!



i want a thing like w3schools but simple

please help me

thanks a lot

解决方案

if you are trying to include a php script in html document then you can do something like this.

//ShowResult.php

<?php 


var = "Hello World"; ?>



//yourpage.html

 <html>
<head> <?php include "ShowResult.php" ;?> </head>
 <body>

<?php  echo 


var; ?> </body> </html> </html>



What I have done here is to simply create an external php file called "ShowResult.php" where I create a variable called var and assigned it a value of "Hello World". In the html file called "yourpage.html" I have called the php file using the php "include" function.

In you can apply this principle in other situations to call an external php script in your html file. have a look here for more help.


这篇关于如何将一些php和html代码发送到页面然后运行它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆