Basic PHP Primer

Source: Internet
Author: User
Tags php source code
Introduction: This is the PHP basic introduction of the detailed page, introduced and php,php PHP Basic introduction of knowledge, skills, experience, and some PHP source code.

class= ' pingjiaf ' frameborder= ' 0 ' src= ' http://biancheng.dnbcw.info/pingjia.php?id=350526 ' scrolling= ' no ' > environment.
If you have a space in the project name, you need to change the name of the project, the name does not allow spaces, otherwise, cannot parse.
(1) Change the port in the httpd.conf file under the Conf folder under Apache, the default 8080 port is occupied,
(2) Click the. exe executable file under Project. Then there will be an icon in the lower right corner, left click on the icon, click Start All.
(3) Visit the page. http://localhost:8080/
1. If you want to import PHP files, or write some PHP code (such as add and delete changes to the statement and Echo, etc.) of the code, you need to include the " ”
2. In the foreground section, you need to pull out the header and footer, and each page that needs to be decorated is imported into both pages.
3.session_start () begins session. Decide if you want to log in, and you can take out the things you saved in the session.
4. Use $_post to take a value from the page.
5. Declare variables using the $ variable name, for example: $user.
6. Output ――echo back with the data you want to output.
For example:
(1) Output string: echo "string";
(2) Output variable: echo $user;
(3) Output Alert:echo "";
After each statement is complete, use the; Number to end.
7. The associated use of ".", equivalent to "+" in Java, for example: ' ". $user."
8.target= "_self" opens on the current page. Do not write default. If the IFRAME is nested, you need to write your IFRAME name.
9. $db the meaning of->query:
(1) $db is clearly a database operation object, typically under the Db_class file in the include.
(2) = Call or affiliation (the arrow to the left of the arrow to the right of the parent), the equivalent of C inside the "." It can be simply understood that the left side is an object, and the right side is the property or method of the object.
(3) A method in the query database object that executes the MySQL command and returns the result of the execution.
The Htmlspecialchars and htmlentities functions in 10.php can convert special characters in HTML into corresponding character entity. However, they still have a difference, the difference 1: When there is Chinese, it is best to use htmlspecialchars, otherwise there may be garbled
The difference 2:htmlentities has three optional parameters, namely $quote_style, $charset, $double _encode
Conclusion: The difference between the Htmlspecialchars and Htmlentities functions is that htmlspecialchars will only convert several HTML character entity listed in the manual (That is, the basic characters that will affect the parsing of the HTML) and htmlentities will convert all of them. In general, using Htmlspecialchars to convert basic characters is enough, there is no need to use the Htmlentities function, it is necessary to pay attention to the third parameter to pass the correct encoding

This is just some basic, I have to write down in the study for later use. To be continued 、、、

Love EE focus on Java Michael Jackson Video station JSON online tool

Http://biancheng.dnbcw.info/php/350526.html Pageno:3
  • 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.