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 AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

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

Some players are experiencing a strange issue on PS4 or PS5 at launch. For example, this can cause distress when their PlayStation Network login fails, but their internet connection is fine. You may encounter errors when entering your login information and may not be able to join PSParty chat. If you encounter a similar problem, this guide may help you solve it. Next to PlayStationNetworkSign-in, you will see the error message ‘AnErrorHaveAreAre’ and it will say ‘Failure’. Other parameters like getting IP address, internet connection and connection speed were successful. So, what could be the problem here? I will give you a job

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

The AADSTS7000112 error may prevent you from logging into the app using your Microsoft account, causing you inconvenience. This article will provide you with solutions to help you resolve this issue and restore a normal login experience. Login: Sorry, you are having trouble logging in. AADSTS7000112: Application disabled. Fortunately, you can fix the error by following some simple suggestions. What is error code AADSTS7000112? Error code AADSTS7000112 indicates a problem with the connection to Microsoft's Azure Active Directory. Typically, this may be due to the Microsoft application trying to log in being blocked.

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

Mistlock Kingdom is an open world game where players can play as Sons of Fire to survive and explore. The game combines the unique entertainment of action RPG challenges, bringing players endless surprises and joy. In the game, players can explore resources, environments, weapons and more. Some novice players may be curious about how to get started with the game. In this introduction and sharing, we will provide you with some relevant getting started guides. Tips for Beginners to the Fog Lock Kingdom: The danger levels of areas shrouded by miasma are different. During the exploration process, new areas of the map will be gradually unlocked, and the location of the areas shrouded by miasma can be seen. The map will be distinguished by two colors. The blue area can be entered in a short time. The time you can stay will also be different depending on the character's ability level.

How to log in to corporate WeChat email How to log in to corporate WeChat email Mar 10, 2024 pm 12:43 PM

How to log in to the email address of Enterprise WeChat? You can log in to the email address in the Enterprise WeChat APP, but most users don’t know how to log in to the email address. Next is the graphic tutorial on how to log in to the email address of Enterprise WeChat brought by the editor for interested users. Come and take a look! Enterprise WeChat usage tutorial How to log in to the Enterprise WeChat email 1. First open the Enterprise WeChat APP, go to the [Workbench] at the bottom of the main page and click to come to the special area; 2. Then in the workbench area, select the [Enterprise Mailbox] service; 3. Then jump to the corporate email function page, click [Bind] or [Change Email] at the bottom; 4. Finally, enter [QQ Account] and [Password] on the page shown below to log in to the email.

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

Anchor Arrival is a 3D turn-based card game with a high-definition beautiful girl two-dimensional theme. It provides a rich and exciting combination of characters for players to explore and experience. It has many powerful combinations of high-quality lineups. New players are also curious novices. What powerful characters are recommended in the pool? Let’s take a look at the selection reference for novices to win ten consecutive golds! Anchor Point Advent is a powerful character recommendation for novice pools. The first ten-consecutive pick is Alice. She is mainly a single-target lightning-type burst character. The output is very explosive, and the experience will be very friendly to newcomers, so it is highly recommended to choose it. It is recommended to choose the combination of "Alice" + "Antelope" for 10 points. Alice is the most worthy character to output the goldpire attribute, and is not even a bit stronger than the other two characters in the novice card pool. Alice can pass special

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

Session failure is usually caused by the session lifetime expiration or server shutdown. The solutions: 1. Extend the lifetime of the session; 2. Use persistent storage; 3. Use cookies; 4. Update the session asynchronously; 5. Use session management middleware.

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

Essential skills for newbies to PyCharm: Mastering the use of batch indentation requires specific code examples Overview: PyCharm is a powerful Python integrated development environment (IDE) that provides many practical tools and functions to help developers improve efficiency . In the daily coding process, we often need to indent the code to keep the code format neat and beautiful. The batch indentation function provided by PyCharm can help us quickly batch indent the code and improve coding efficiency. This article will explore Py

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

Solution to the cross-domain problem of PHPSession In the development of front-end and back-end separation, cross-domain requests have become the norm. When dealing with cross-domain issues, we usually involve the use and management of sessions. However, due to browser origin policy restrictions, sessions cannot be shared by default across domains. In order to solve this problem, we need to use some techniques and methods to achieve cross-domain sharing of sessions. 1. The most common use of cookies to share sessions across domains

See all articles