Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial php新手问题,关于session部分的,很简单的,就是不知道为什么按登陆后出现这样的问题

php新手问题,关于session部分的,很简单的,就是不知道为什么按登陆后出现这样的问题

Jun 23, 2016 pm 01:54 PM
session newbie Login


为什么不按正常的php那样来显示呢?
我在浏览器上直接上又变成这样了。。


回复讨论(解决方案)

file:// 是文本协议,php 需在 http:// 下运行

前两条是说 session_start 前面有输出,违规了
后一条是说 mysqli 扩展没有加载

二楼说的很全了。。无话可说了。。。

<?phpsession_start();$userName = $_POST['userName'];$password = $_POST['password'];$db_conn = new mysqli("localhost","webauth","webauth","bookfish");if(mysqli_connect_errno()){	echo 'Connection to database failed:'.mysqli_connect_error();	exit();}$query = 'select * from authorized_users '		 ."where name = '$userName'"		 ."and password = sha1('$password')";$result = $db_conn->query($query);if($result->num_rows){	$_SESSION['userName'] = $userName;}$db_conn->close();if(isset($_SESSION['userName'])){	require('home_page.php');}else{	require('login.php');}?>
Copy after login


我还是把代码贴出来吧,因为二楼说的我都认真看了,还是没解决问题,因为我已经在window/system32上加载了mysqli.dll也已经把php.ini上的mysqli的分号去掉了,也没起效,还有说的session_start();要放在第一行,我确实是这样做的

file:// 是文本协议,php 需在 http:// 下运行

前两条是说 session_start 前面有输出,违规了
后一条是说 mysqli 扩展没有加载

关于 session_start 报错的问题
由于你没有把错误信息贴完整,所以不好说什么
估计是你的程序文件头 BOM 头

关于 mysqli 的问题
要么是你看错了 php_mysql.dll 和 php_mysqli.dll 是两个东西
要么是你改错了 php.ini

关于 session_start 报错的问题
由于你没有把错误信息贴完整,所以不好说什么
估计是你的程序文件头 BOM 头

关于 mysqli 的问题
要么是你看错了 php_mysql.dll 和 php_mysqli.dll 是两个东西
要么是你改错了 php.ini



上面这三张图是我按书上一步步修改的,还有谢谢我是用notepad++把格式修改了一下,现在只是下面这个问题没有解决了

加一句
LoadFile "G:/php/php5ts.dll"

加一句
LoadFile "G:/php/php5ts.dll"


无效,不知道是不是因为没安装PEAR出错了,网上是这样说的:在你的pear目录中可以找到PEAR.PHP文件,这是管理pear的命令,在CMD中使用
完全看不懂是什么意思,PEAR.PHP找到打开又能怎样,怎么在CMD中使用啊,找来找去都是这样说的
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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PlayStation network login fails, but internet connection succeeds PlayStation network login fails, but internet connection succeeds Feb 19, 2024 pm 11:33 PM

PlayStation network login fails, but internet connection succeeds

Fix AADSTS7000112, Application is disabled Microsoft account login error Fix AADSTS7000112, Application is disabled Microsoft account login error Feb 19, 2024 pm 06:27 PM

Fix AADSTS7000112, Application is disabled Microsoft account login error

Tips for playing the Mist Lock Kingdom to give newbies a guide Tips for playing the Mist Lock Kingdom to give newbies a guide Jan 28, 2024 pm 03:33 PM

Tips for playing the Mist Lock Kingdom to give newbies a guide

How to solve session failure How to solve session failure Oct 18, 2023 pm 05:19 PM

How to solve session failure

Anchor Point Advent Novice Ten Company Character Recommendations Anchor Point Advent Novice Ten Company Character Recommendations Feb 20, 2024 pm 02:30 PM

Anchor Point Advent Novice Ten Company Character Recommendations

Solution to PHP Session cross-domain problem Solution to PHP Session cross-domain problem Oct 12, 2023 pm 03:00 PM

Solution to PHP Session cross-domain problem

Learning to use batch indentation is a skill that PyCharm newbies must master Learning to use batch indentation is a skill that PyCharm newbies must master Dec 30, 2023 pm 12:58 PM

Learning to use batch indentation is a skill that PyCharm newbies must master

GeForce Experience login freezes [Fix] GeForce Experience login freezes [Fix] Mar 19, 2024 pm 06:30 PM

GeForce Experience login freezes [Fix]

See all articles