在HTML代码中嵌入php? [英] Embedding php in html code?

查看:76
本文介绍了在HTML代码中嵌入php?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我是一个新手到php并在一个网站上工作的网站,上面有很长的

代码,可以作为包括除了一两件东西之外

更换。

我测试了以下内容并且它有效,但我真的想知道

我可以将PHP代码放在像这样的html行中,或者可能会出现问题吗?

<! - test.php的html代码 - >

<! - 很多代码剪切 - >

< a href ="<?php print $ filename; ?>"><?php print $ title; ?>< / a>

<! - 很多代码剪切 - >

<! - 结束test.php - > ;


<! - 在这样的主文件中调用 - >

<?php

$ filename =" index.php";

$ title =" Index Page" ;;

include(" test.php");

?>


-

Ken Ward in Norwich ke *@oldcity.f2s.com

对于Norwich和East Anglia,请访问 www.oldcity.org.uk

解决方案

filename; ?>"><?php print


title; ?>< / a>

<! - 很多代码剪切 - >

<! - 结束test.php - > ;


<! - 在这样的主文件中调用 - >

<?php

filename =" index.php";


Hi All,

I''m a new boy to php and working on a web site with long sections of
code that could be done as includes apart from one or two things
changing.
I''ve tested the following and it works, but what I really want to know
is am I OK placing php code inside a html line like this, or could there
be problems?
<!-- html code for test.php -->
<!-- lot of code cut -->
<a href="<?php print $filename; ?>"><?php print $title; ?></a>
<!-- lot of code cut -->
<!-- end of test.php -->

<!-- which is called in the main file like this -->
<?php
$filename="index.php";
$title="Index Page";
include ("test.php");
?>

--
Ken Ward in Norwich ke*@oldcity.f2s.com
For Norwich and East Anglia visit www.oldcity.org.uk

解决方案

filename; ?>"><?php print


title; ?></a>
<!-- lot of code cut -->
<!-- end of test.php -->

<!-- which is called in the main file like this -->
<?php


filename="index.php";


这篇关于在HTML代码中嵌入php?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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