Session_Start()的问题。新手在Php ...我会感谢任何帮助 [英] Problem With Session_Start(). Newbie In Php ... I Would Appreciate Any Help
本文介绍了Session_Start()的问题。新手在Php ...我会感谢任何帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<?php
//开始会话
session_start();
?>
<!DOCTYPE html>
< html>
< body>
//套装会话变量
$ _SESSION [favcolor] =green;
$ _SESSION [favanimal] =cat;
echo会话变量已设置。;
?>
< / body>
< ; / html>
即使在最简单的代码中,每当我尝试运行该文件时我都会收到以下错误:此网页不可用
解决方案
_SESSION [favcolor] =green;
_SESSION [favanimal] =cat;
echo会话变量已设置。;
?>
< / body>
< / html>
即使在最简单的代码中,每当我尝试运行该文件时我都会收到以下错误:此网页不可用
你的代码写错了......
你开始使用PHP块,而不是去HTML部分,但是在中间你开始再次编写PHP但没有正确的区块开放...
首先阅读: PHP:session_start - Manual [ ^ ],有几个样本要学习......
之后检查此代码:
< !DOCTYPE html < span class =code-keyword>>
< html >
<? php
// 启动会话
session_start();
// 设置会话变量
<?php
// Start the session
session_start();
?>
<!DOCTYPE html>
<html>
<body>
// Set session variables
$_SESSION["favcolor"] = "green";
$_SESSION["favanimal"] = "cat";
echo "Session variables are set.";
?>
</body>
</html>
Even in the simplest code , whenever i try to run the file im getting the following error: This webpage is not available解决方案_SESSION["favcolor"] = "green";
_SESSION["favanimal"] = "cat";
echo "Session variables are set.";
?>
</body>
</html>
Even in the simplest code , whenever i try to run the file im getting the following error: This webpage is not available
Your code written wrong...
You start with a PHP block, than going to the HTML part, but in the middle you start writing PHP again but without the proper block opening...
First read here: PHP: session_start - Manual[^], there are several samples to learn from...
After that check this code:
<!DOCTYPE html> <html> <?php // Start the session session_start(); // Set session variables
这篇关于Session_Start()的问题。新手在Php ...我会感谢任何帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文