Home > Backend Development > PHP Tutorial > The Fourteen Most Confusing Questions for PHP Beginners_PHP Tutorial

The Fourteen Most Confusing Questions for PHP Beginners_PHP Tutorial

WBOY
Release: 2016-07-13 17:12:10
Original
851 people have browsed it

【1】Variables cannot be passed between pages
Get, post, session automatic global variables are turned off in the latest PHP version, so to get the submitted variables from the previous page, use $_GET['foo'] ,$_POST['foo'],$_SESSION['foo'] to get. Of course, you can also modify the automatic global variables to be on (php.ini is changed to register_globals
= On); considering compatibility, it is better to force yourself to become familiar with the new writing method.
[2] Using the get method to pass Chinese parameters to apache2 under Win32 will cause an error:
test.php?a=Hello&b=Hello
Passing parameters will cause an internal error

Solution: "test.php?a=".urlencode(Hello)."&b=".urlencode(Hello)
  .............
 【 3] The session under win32 does not work properly
The default session.save_path of php.ini = /tmp
This is obviously the configuration under linux. PHP cannot read and write the session file under win32, causing the session to be unusable. Please change it. Just make it an absolute path, for example, session.save_path
= c:windows emp
[4] Display error message
When display_errors in php.ini = On and error_reporting =
E_ALL, the Display all errors and prompts. It is best to turn it on during debugging for error correction. If you use the previous PHP writing method, most of the error messages are about undefined variables. There will be a prompt when a variable is called before it is assigned a value. The solution is to detect or shield it.
For example, to display $foo, you can if(isset($foo)) echo $foo or echo @$foo
【5】mail() cannot send emails under Win32
Configure sendmail under Linux It can be sent. Under win32, you need to call the smtp server to send emails. Modify the SMTP of php.ini = ip
//ip is an smtp server without verification function (hard to find online)
PHP sends emails The best solution is to use socket to send directly to the other party's email server without forwarding the server.
 【6】If the password is not set for the initial installation of mysql, you should use update mysql.user set password="yourpassword" where
user="root" to change the password
 【7】header already sent
This error usually occurs when you use HEADER. It may be due to several reasons: 1. You PRING or ECHO before using HEADER. 2. There is a blank line in front of your current file. 3. You may have INCLUDEd a file. The file This error will also occur if there is a blank line at the end or the output. !

【8】No change after changing php.ini
Restart the web server, such as IIS, Apache, etc., and then the latest settings will be applied.
【9】php is installed on 2003 (the installation method of ISAPI is requested by experts for advice)
PHP4’s php4isapi.dll seems to have some conflicts with 2003 and can only be installed in CGI mode

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629501.htmlTechArticle[1] Variables get, post, session cannot be passed between pages. In the latest php version, the automatic global variable is is closed, so to get the submitted variables from the previous page, use $_GET['fo...
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template