One post learn PHP
System length 32678 bytes, remove punctuation, also can play 10,000 words, if write full, that is not short.
In the spirit, perverted simple, smooth in the end of the MJJ for the vast number of impetuous to browse the principle, I try to streamline the effective practical way to explain PHP learning.
This article is suitable for audiences:
Skilled in HTML, but not in the dynamic language such as PHP, but in the Dedecms or Discuz and other PHP program people.
Of course, you also want to learn PHP interest. After all, even if the simple also need to learn the motivation, interest is undoubtedly the best.
Not familiar with computer operation, absolute path, relative path and other things please on Mars.
Prerequisite Preparation:
Attitude: Earnest, careful, not impetuous.
Time: only two hours , but please note the full time of two hours. Do not take a moment to do something else, because in the study of the time one but interrupted, and then back to the inevitable there is above his business suspicion, and I for the top PHP non-professional professional writers fabricated, unable to systematically teach, One but the interruption back to see this article will be useless. So please prepare for two hours. I try to make this article available within two hours for you to get to PHP.
Environment Erection: ① stand-alone. ② suitable for novice use of the integrated environment, ③ I recommend the software: Apmserv download address (PHP version 5.2.0)
In order to prevent the super new newcomer in the environment to set up this piece of the card, I first sent a apmserv set up the environment of the tutorial stickers. Click to view. Construction Operation area.
Before you start the FAQ
Q: Can I become a master after two hours of serious study?
A::tu: Less with me yy, " a paste learning php" purpose only in a simple learning php! can only let you two hours after the general understanding of PHP, there is a deep learning base. Please do not have illusions, down-to-earth, step-by-step for the win. After reading, even if not to become a master, will also go further.
Q: What do I need to use the editor for something?
A: This tutorial is only used by Macromedia Dreamweaver 8 Editor., the editor is not a must. Text can also do Web pages!
Q: Do you have too much nonsense?
A: Be hungry, then start right away.
————————————————————————————————————–
============= Shameless split-line =============
Eat one:
One : the iconic language.
There are tags at the beginning of the HTML, and the contents of the entire HTML page are included.
The corresponding in PHP can be so yy, he has only one label all the things in the back of the PHP position.
Line one: row two: A section of PHP code
Line three:?>
All of these DIY projects:
DW New, dynamic page, PHP, code mode, delete all content, then enter inside and then go back , and before deleting the key several times, experience the red virgin thrill! Just a few minutes have started to write PHP pull ~ Strong karma, Master also ~
Single : the simplest output
The naughty person may be in the above "a Little PHP code" location hit something, and then save the open after a look, a blank and even wrong ...
Because PHP is certainly not HTML, he is the server language, the so-called server language is you drive to this page, and then the server to parse the rules into HTML and then return to you open. A server parsing process is more than HTML.
Try the following code:
echo ' smile and eat so handsome. '
?>
Save file name yy.php after open, such as the default is PHP, it must be in support of PHP environment to open only effect. If you're having trouble here, check to see if Apmserv is on, and if the file location you saved is in the Apmserv directory Www\htdocs If all is right, then look at the browser address is not http://127.0.0.1: Port/yy.php
Three: the most common mistakes
Then modify the code as above:
echo ' smile and eat so handsome. '
Echo ' is really cute.
?>
Do you find errors when saving open? This is the most common and most idiotic and common PHP error in history.
PHP is parsed on a row-by-line basis, with an understanding of "line". At the end of each line you need to add ";" ... Is the letter l to the right of one.
I am also very puzzled, the more annoying is no error correction function, all can not open a mistake, fortunately, the error will show the wrong line.
Four : the most important concept
The previous code is added as "; "After opening, you will find the display effect." Smile and eat good handsome ah really good handsome ah "stick together.
Right-click on the source file and you will find that the original source file is the same. What about that?
PHP is a kind of HTML can be inserted in the language, that is, he can give the HTML to QJ off ...
Theoretically all can be inserted into the HTML to go ... Copy the following experience ...
Five: the most important applications
If you have not moved your hand here, please feel free to move your hands, all of which are only a few minutes, but there is an important experience process.
Seriously do the people will find that PHP such a sub-learning has a fart to use? So now ... I can't tell you what it's for, and then here's the variable.
I try to use less terminology and try to be as popular as possible, but the word variable can't find a substitute. But very well understood, and then look.
$chifan = "123er";
Echo $chifan;
?>
After saving opens, the content that is displayed is 123er, then the familiar HTML is easy to think to modify the code in the "" between the 123ER can be modified display content!
No mistake, and theoretically modify two Chifan, as long as they are the same, can also be displayed.
This is only two lines, the first line is the value of the definition variable chifan is 123er, the second line is to display the variable Chifan. It's so simple.
It's easy to learn how to define variables and display variables!
Eat two:
After eating a simple and interesting lively study, do you think that PHP is not really difficult? But are you also starting to worry about PHP being useless?
This section details the conceptual nature of PHP.
Obviously there is no previous article vivid, this paragraph is not necessary, if just want to understand but not to learn the completely can skip this paragraph. <>
R/>PHP Functions:What is a function? for example, Y=2X is a function, so as long as you know X you can get the corresponding y out. PHP's powerful function library is one of its main features, such as the function for MySQL, so only the database name User name password can be a free and simple connection to the database.
PHP Manual: A booklet documenting PHP syntax and functions, because not everyone can remember every function of each syntax. So most people use it when they need to find a manual. Its meaning, to make a simple analogy, such as the Y=2X function, you do not know that there is this function you have to count as X+x, But if you know of a y=2x function, you just need to call the function Y and enter X to get the result. For PHP manuals, it is recommended to take time to look at the time and see again, can't remember but can remember what features inside. Maybe x+x you can write it yourself, but more complicated you may not be able to write it, Even if the writing is a little laborious, the more troublesome the problem of calling out-of-the-box functions becomes more and more obvious and necessary.
Write your own function, function and meaning so powerful, but always have their own unique needs of the function, function can write their own, good at using the function can achieve a multiplier effect ... So much nonsense is all about re-understanding the function, the visible function is how important!
The last recommendation or understanding of the metaphor, a few useful functions such as time call function, IP address acquisition function, can be found in the manual, simply call the function to display the results can easily get the time and IP address you want to customize. (I have no idea what I'm going to do.)
face the object and face the process: please Baidu or GG, feel more and more digress ... From the simple theme.
syntax Details:
Such as: What is the difference?""And") and the difference between the full angle and the half angle. "" () () and How to show "" These define variables for things like headaches!... I had a headache when I thought about it. It must be a headache to see this coming.
There is no difference between full-width and half-width, the same function. Perfect.
How to display the syntax of the symbol is not difficult, just need to add a/in front of the corresponding symbol. But it looks awkward.
The difference between a double-lead and a single-lead is that the double-citation parses the variable, and the single-lead is displayed directly.
$MJJ = "haha";
Echo $MJJ;
echo "
" ;
echo "This is $MJJ";
echo "
" ;
Echo ' This is $MJJ ';
?>
The following three are a small complement to the usual syntax. Then start the internship.
constant: Define
Define ("Page_title", "MJJ page");
Define ("Page_body", "MJJ is a wooden chicken");
?>
<title><?php Echo Page_title?></title>
more simple output
If the above title sentence can be replaced by:
<title><?= Page_title?></title>
page calls require and include
All 2 call other pages, PHP is a line-wise translation, but require is a priority call, and include is translated when reading this line.
How to use the call, is the great art of the gate. (for fear of error require you can use require_once to invoke this page only once) format as follows:
Require_once './include/286.php ';
Include ' mjj.php ';
Build yourself a 286.php or mjj.php to call to play. txt but must conform to PHP syntax. Used when PHP is used.
Three meals:
instance: One line URL jump code
copy content to clipboard
Code:
If saved as aaa.php, can realize aaa.php?url=www.baidu.com jump to Baidu effect.
This simple invocation of the default $_get variable. and PHP default jump location:
(more default variables are in the manual)
instance Upgrade: Increase if loop
copy content to clipboard
Code:
$url=$_GET["url"];
if (strlen($url >= '3')){
header("Location:"."http://".$url);
}
?>
URL转向页
So much has not been said about the cycle, as the most difficult content of the tutorial (to set off a stick to learn how simple ~)
This upgrade code is very simple, that is, the jump page can also be opened, when get down the URL address is greater than 3 o'clock to jump.
After you have finished your study:
If you are inspired to learn PHP and feel that you have actually gotten started (and you haven't seen it yet), there are two advanced methods.
Robust type can first read the PHP manual, and then start to find the message book, blog, BBS (order, can be first text and then MySQL) to start a step-by-step re-production.
Passionate type, you can directly start to find instances to begin to follow the example step by step to do, some feeling feel inadequate after the PHP manual supplement. There are too many instances on the network.
improve the stage: understand the changes and differences in PHP4,PHP5,PHP6. The main focus is on the current popular PHP program. (This will also need to adapt to an editor, if it is possible to better understand a certain framework, the outdated forum has published the framework, the code area see.) Open source PHP program will bring you a new experience, understand the future can not be at least to change the understanding.
advanced Stage: I do not have the qualifications to introduce. I hope we all become masters together.
Finally, I wish all the friends who are interested in PHP can become master!
————————————-Split Line —————————
Finally completed, do not rule out a loophole, this article total time 4 hours + 3 hours. Hope to help the friends who need them.
echo ' smile and eat so handsome ';
Echo ' really good-looking ';
?>
Please note that the color that the DW helps to display is very useful.
Friendship Advertising: This effect for the top of the forum behind the code, there is a need to be widely imitated use.
http://www.bkjia.com/PHPjc/320448.html www.bkjia.com true http://www.bkjia.com/PHPjc/320448.html techarticle A paste Learn php system length 32678 bytes, remove punctuation, can also play 10,000 words, if write full, that is not short. In the spirit, the metamorphosis of the simple, smooth in the end for the vast number of impetuous mjj ...