html嵌套php显示用户名

WBOY
Release: 2016-06-23 13:32:09
Original
1683 people have browsed it

$result=mysql_query("select * from user where username='$username'");
if($result)
{
$row=mysql_fetch_row($result);
if($row[1]==$password)
{
session_start();
$_SESSION["username"]=$username;
}
登录的时候把用户名写到session里。在另一个html文件中显示的时候
session_start();
echo "

用户名

".$_SESSION['username'];
?>
为什么不可以?还有为什么会输出?>这个东西????


回复讨论(解决方案)

在另一个 html文件中显示的时候????

在另一个 html文件中显示的时候????


恩恩,前面登录是php文件。后面代码是html中嵌套的php代码。

php 代码只在 php 文件中被执行

输出的是什么

php 代码只在 php 文件中被执行


???html中不能嵌套php么?

输出的是什么


输出的是用户名".$_SESSION['username'];?>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!