Variable get,post,session cannot be passed between "1" pages in the latest version of PHP the automatic global variable is turned off, so to get the submitted variable from the previous page use $_get[' foo '],$_post[' foo '],$_session['. Foo '] to get
Of course, you can also modify the automatic global variable to open (php.ini changed to Register_globals = ON), and it is better to force yourself to be familiar with the new wording, considering compatibility.
"2" Win32 under the apache2 to pass the Chinese parameter with get method will make an error
test.php?a= Hello &b= You
Passing parameters can cause an internal error
Solution: "Test.php?a=". UrlEncode (Hello). " &b= ". UrlEncode (you are also good)
.............
The session under "3" Win32 does not work properly
php.ini default Session.save_path =/tmp
This is obviously a Linux configuration, Win32 under the PHP cannot read and write session file causes session not to use
Change it to an absolute path, such as Session.save_path = C:\Windows\Temp
"4" displays an error message
When PHP.ini's display_errors = on and error_reporting = E_all, all errors and prompts are displayed, and it is best to turn on the error when debugging, if you use the previous PHP error message is mostly about undefined variables. Variables are prompted before they are assigned, and the solution is to detect or mask
For example, $foo can be displayed, if (Isset ($foo)) echo $foo or echo @ $foo
"5" Win32 Mail () cannot send e-mail
SendMail configured under Linux can be sent, under Win32 need to invoke the SMTP server to send e-mail
modifying php.ini SMTP = IP//ip is an SMTP server without authentication (hard to find on the web)
The best solution for PHP to send mail is to send it directly to the other email server without forwarding the server
"6" first installed MySQL if you do not set a password, you should use
Update Mysql.user set password= "YourPassword" where user= "root"
Modify password
"7" header already sent
This error usually occurs when you use the header, he may be several reasons: 1, you are Pring or Echo 2 before using header. 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 error in the output.
No change after "8" change php.ini
Restart the Web server, such as Iis,apache, and so on before applying the latest settings
"9" PHP installed on 2003 (ISAPI installation method kindly advise)
PHP4 's php4isapi.dll seems to be in conflict with 2003 and can only be installed in CGI mode
Step One, First www.php.net in a setup program, I was installed is: Php-4.2.3-installer.exe, you can also go to find the latest version, in the installation of Php-4.2.3-installer.exe before you ensure that your IIS6.0 started, and can access. After installation,--> application configuration on the default Web site
Step Two: Click the Web Services extension--> to create a new Web service extension.
Step three: Extension-->php, and then add
Step four: Find the path of php.exe add up.
Step five: Be sure!
Step Six: Select the service Extensions for PHP and click Allow.
"10"
Sometimes the SQL statement does not work and the database operation fails
The easiest way to debug, echo-SQL, look at the value of the variable to get no
The difference between "11" include and require
There is not much difference between the two, if the file you want to include does not exist, include prompts notice, and then continue to execute the following statement, require prompt for fatal error and exit
As far as I have tested, they are all included in the Win32 platform, so it is best not to have include or require statements in the included files, which can cause directory clutter. Maybe *nux under different circumstances, not yet tested.
If a file does not want to be included multiple times, you can use include_once or require_once## read to write document data
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") {
$filenum = @fopen ($file _name, $method);
Flock ($filenum, LOCK_EX);
$file _data=fwrite ($filenum, $data);
Fclose ($filenum);
return $file _data;
}
The difference between
12 "isset () and empty ()
is both for the test variable
but isset () is to test whether the variable is assigned, and empty () is to test whether a variable that has already been assigned is NULL
If a variable is not assigned to the reference in PHP is allowed, but there will be notice hint
If a variable is null, $foo = "" or $foo=0 or $foo =false, then empty ($foo) return True, Isset ($foo) also return true , which means that the null value does not unregister a variable.
to unregister a variable, you can use the unset ($foo) or $foo=null
"13" MySQL query contains keyword
php query mysql, sometimes MySQL table name or column name will have a keyword
This time the query will have errors. For example, the table name is an order, the query can be an error
simple way is the SQL statement table name or column name plus ' [tab] to distinguish between
such as SELECT * from ' order '
' 14 ' upload multiple files through HTTP protocol one way The
has two ideas, which are two implementations of the same method. The specific program also needs to design
1, set up multiple file input boxes in form, and name them by array, as follows:
<form action= "" Method=post>
<input type=file name= Usefile[]>
<input type=file name=usefile[]>
<input type=file name=usefile[]>
</form>
So, do the following test on the server side
Echo <pre>;
Print_r ($_files);
echo "</pre>";
1, set up multiple file input boxes in the form with different names, as follows:
<form action= "" Method=post>
<input type=file name=usefile_a>
<input type=file name=usefile_b>
<input type=file name=usefile_c>
</form>
Do the same test on the server side:
echo "<pre>";
Print_r ($_files);
echo "</pre>";