The basic php_php of first knowledge

Source: Internet
Author: User

1. In PHP, global variables are capitalized;

2. In the php form submission method, the method property sets the way to obtain and submit the data;

3. If you use the upload element in your form, add attributes to the form: enctype= "Multipart/form-data";

4. Cancellation of user function implementation:

Copy Code code as follows:

<?php
Session_Start (); Start session
unset ($_session[' user '); Delete a single session
unset ($_session[' pwd ')); Delete a single session
Session_destory (); End Current reply
Header ("location:index.php"); redirect
?>

Delete Multiple sessions: $_session=array ();

5.php Traversal of objects:

Copy Code code as follows:

For ($i =0 $i <count ($_post["name"); $i + +) {
Processing
}

6.php contains files: include ("File path");

7. Embed the JS script in the HTML page way:

Copy Code code as follows:

<script language= "JavaScript" >
JS function
</script>

8. Refer to JS file in PHP dynamic page:

Copy Code code as follows:

<script language= "JavaScript" >
JS function
</script>
Or:
<script language= "Javascript" src= "url" >
JS function
</script>

9. Solution Browser does not support JavaScript issues:
A. Open IE browser to JavaScript support;
B. Open IE browser support for local javascript;
C. Apply the annotation symbol to verify that the browser supports JavaScript script functionality;
D. Apply <noscript></noscript> tag Verify that the browser supports JavaScript scripting.

10. In PHP, single quotes and double quotes have different processing mechanisms, and their differences are:
The contents of double quotes can be interpreted and replaced, while the north wing of single quotes is treated as ordinary characters. Such as:

Copy Code code as follows:

<?php
$test = "PHP";
$str 1= "I like $test";
$str 2= ' I like $test ';
Echo $str; Output: I like PHP;
Echo $str; Output: I like $test;
?>

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.