PHP Beginner Headache Problem Summary and Analysis _php tutorial

Source: Internet
Author: User
Tags urlencode
PHP (as the mainstream development language now) Beginners Headache problem Summary!
  
The variable cannot be passed between the "1" page get,post,session in the latest version of PHP (the current mainstream development language), the automatic global variable is turned off, so the variables to be submitted from the previous page are used $_get[foo],$_post[foo],$_ Session[foo] to get
Of course, you can also modify the automatic global variable to ON (PHP (as the current mainstream development language). ini to register_globals = on); It is better to force yourself to be familiar with the new wording, considering compatibility.
  
"2" Win32 Apache (Unix platform's most popular Web server platform) 2 error passing Chinese parameter with get method
Test.php (as the current mainstream development language)? a= Hello &b= you.
Passing parameters can cause an internal error
Solution: "test.php (as the current mainstream development language)?" A= ". UrlEncode (Hello)." &b= ". UrlEncode (you're good too)
  
The session under "3" Win32 does not work properly
PHP (as the current mainstream development language). ini default Session.save_path =/tmp
This is obviously the configuration under Linux, Win32 PHP (as the current mainstream development language) cannot read and write session files resulting in the session can not be used
Change it to an absolute path, for example Session.save_path = C:windowsemp
  
"4" Displays error message
When PHP (as the current mainstream development language). ini display_errors = on and error_reporting = E_all, all errors and hints will be displayed when debugging, preferably open for error correction if you use previous PHP ( As the current mainstream development language) The error message is mostly about undefined variables. Variables are called before they are assigned, and the solution is to detect or block
For example, $foo can be displayed, if (Isset ($foo)) echo $foo or echo @ $foo
  
"5" Win32 Mail () cannot send email
The SendMail configured under Linux can be sent, and the SMTP server needs to be called to send e-mail under Win32
Modify PHP (as the current mainstream development language). ini = IP//IP is an SMTP server without authentication (hard to find online)
PHP (as the mainstream development language now) the best way to send mail is to send the socket directly to the other email server instead of forwarding the server
  
"6" MySQL (best combination with PHP) If you don't have a password set, you should use
Update MySQL (the best combination of PHP collocation). User set password= "YourPassword" where user= "root"
Change Password
  
"7" header already sent
This error usually occurs when you use the header, he may be several reasons: 1, you use the header before the Pring or Echo 2. You have a blank line 3 in front of your current file. You may include a file with a blank line at the end of the file or an output that will also cause this error.
  
"8" Change PHP (as the current mainstream development language). No changes after INI
Restart the Web server, such as IIS (Microsoft Web server platform), Apache (the most popular Web server platform for UNIX platforms), and so on, before applying the latest settings
  
"9" PHP (as the current mainstream development language) on the 2003 installation (ISAPI installation method Request Master advice)
PHP (as the current mainstream development language) 4 PHP (as the current mainstream development language) 4isapi.dll seems to be in conflict with 2003, only with CGI (now no more people in use) mode installation
Step one, first www.php (as the current mainstream development language). NET under a setup program, I am Loaded is: PHP (as the current mainstream development language) -4.2.3-installer.exe, you can also go to the latest version, in the installation of PHP ( As the current mainstream development language) -4.2.3-installer.exe ensure that your IIS (Microsoft Web server Platform) 6.0 is up and able to be accessed. After installation, in the default Web site--application configuration
Step Two: Click Web Service Extensions--Create a new Web service extension.
Step three: Extension-->php (as the current mainstream development language), then add
Step four: Find the path of PHP (as the current mainstream development language). exe to add up.
Step five: OK, yes!
Step six: Select PHP (as the current mainstream development language) of the service extension, and then click Allow.
  
"10" Sometimes the SQL statement does not work and the database operation fails
The easiest way to debug, echo the SQL, to see if the value of the variable can be
  
The difference between the "11" include and the Require
There is not much difference between the two, if the file to be included does not exist, include prompts notice, and then proceeds to execute the following statement, require prompts a fatal error and exits
According to my test, Win32 platform they are included in the first implementation, so the included file is best not have include or require statements, which will cause the directory confusion. Maybe *nux under different circumstances, not yet tested.
Write document data If a file does not want to be included multiple times and can be read using include_once or require_once##
function R ($file _name) {
$filenum = @fopen ($file _name, "R");
@flock ($filenum, lock_sh);
$file _data= @fread ($filenum, FileSize ($file _name));
@fclose ($filenum);
return $file _data;
}
function W ($file _name, $data, $method = "W") {

http://www.bkjia.com/PHPjc/508613.html www.bkjia.com true http://www.bkjia.com/PHPjc/508613.html techarticle PHP (as the current mainstream development language) Beginners Headache Problem Summary! The variable get,post,session cannot be passed between pages "1" in the latest version of PHP (the current mainstream development language) ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.