HTML代码中的PHP [英] PHP in HTML code
本文介绍了HTML代码中的PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用HTML代码编写了PHP:
I wrote PHP in HTML code :
<div id="loginContainer">
<?php
if(!$_SESSION['id_client']){
print "<a href=\"#\" id=\"loginButton\">";
} else {
print "<a href=\"#\" id=\"loginButton3\">";
}
?>
</a></div>
,但这出现在输出页面中:;}else { print
but this appears in the output page: ;}else { print
如何使PHP执行?
推荐答案
您的文件是否具有.php
扩展名(或者您的服务器是否配置为将该文件作为PHP处理)?
Does your file have a .php
extension (or is your server configured to process that file as PHP)?
如果不是,则整个块:
<?php
if(!$_SESSION['id_client'])
{
print "<a href=\"#\" id=\"loginButton\">
被视为一个大的,丑陋的,无效的HTML标签,其余部分可见.
Is being treated as one big, ugly, invalid HTML tag, leaving the rest to be visible.
确保文件具有.php
扩展名.
这篇关于HTML代码中的PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文