HTML代码之间的PHP代码中的条件语句
发布时间:2020-12-14 22:22:12 所属栏目:资源 来源:网络整理
导读:我使用HTML代码分离的PHP中的条件语句有一个问题。这是我要写的代码类型。这是一个配置文件页面,它应该只被用户的配置文件看到(我使用会话变量来检查): ?php if(check if user is logged in) ?display users profile in html?php else ?display an error
我使用HTML代码分离的PHP中的条件语句有一个问题。这是我要写的代码类型。这是一个配置文件页面,它应该只被用户的配置文件看到(我使用会话变量来检查):
<?php if(check if user is logged in) ?> <display users profile in html> <?php else ?> <display an error> 但这不行。我也尝试使用简写符号:在if和使用endif语句的末尾,但它没有奏效。 (在较早的项目中,该方法为foreach和endforeach工作,所以我以为我会尝试) 有任何想法吗 ? 解决方法
你可能忘记了
alternative control structure syntax的内幕:
<?php if(check if user is logged in): ?> <display users profile in html> <?php else: ?> <display an error> <?php endif; ?> 省略大括号,你写的是不可能的。只有在后面是regular statement才有可能。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |