Several common problems _ PHP Tutorial

Source: Internet
Author: User
Several common problems. 1. configure php. ini and modify session. save_path, for example, session. save_pathd: prepare phptemp or tmp2. program 1.php? Session_start (); $ var1test; session_register (var1 );? 2. ph 1. configure php. ini and modify session. save_path
For example: session. save_path = d:/developer/php/temp or/tmp
2. program
1. php
Session_start ();
$ Var1 = "test ";
Session_register ("var1 ");
?>
2. php
Session_start ();
Echo $ var1;
?>
First run 1.php and then run 2.php. the page displays test
Session "headers already sent" error
Error message: Cannot send session cookie-headers already sent...
This error occurs when session_start (); an output statement exists before the statement.
For example:

Session_start ();
$ Var1 = "test ";
Session_register ("var1 ");
?>



SetJust move it to the back
File Upload
Modify php. ini
Upload_tmp_dir = d:/temp or/tmp
Upload. php
==========================================


PHP Upload



If ($ upload ){
$ Real_path = $ userfile_name;
If (file_exists ($ real_path )){
Unlink ($ real_path );
}
If (! @ Copy ($ userfile, $ real_path ))
$ Upload_flag = false;
Else
$ Upload_flag = true;
}
?>




Example: session. save_path = d:/developer/php/temp or/tmp 2. program 1.php? Session_start (); $ var1 = "test"; session_register ("var1 ");? 2. ph...

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.