As an intermediate Phper rookie. Bored to love in the various PHP forum blind turn. See a lot of PHP beginners have asked many of the same questions. And I've all met when I was learning PHP. to Let PHP beginners to take a few detours. So suddenly a nervous trance. Decided to write down this article. For PHP beginners only. If there is an error. Also hope to point out.
PHP is a very simple and easy to learn language. If you want to be proficient in PHP for more than three years. Less than one year is enough. But why do we still have a rookie after three years?
I don't know what to start with. Learn PHP we have to learn the database. Learn the architecture. Learn the front-end. Learn Linux. Learning protocols and even artwork directly led to the Phper is now the most tired of a programmer.
The most tiring is nothing. PHP is often considered a lower-level program. With the lowest salary. But to master almost all the knowledge of the Web. It is really unfair.
The good news is that we have gradually seen a shift in our country. More and more companies are moving from Java or C # to PHP. So you phper must have their own dreams. You guys are going to be a big cow.
Pull away. Back to the point I'm going to talk about. The following questions contain the problems I have encountered. Maybe I'm not right about that. Or you may not agree with me. I'm very willing to accept your opinion. Anyway, we're just trying to get phper to:-).
1. Problems with coding
This is not only PHP. As long as it is on the program. It will come to me. At least I have met the people around me. and in the Web. Often the coding problem is very difficult to solve. It is very difficult to debug. Sometimes the program out of a puzzling problem, it is difficult to think of coding out the problem and so on.
These problems always haunt us. So I recommend PHP for beginners. Be sure to encode unity. It is strongly recommended to unify for UTF-8. The use of GBK or GB2312 is not recommended. Because this encoding is not known in the case of Ajax transmissions.
If you want to code uniformly, be aware of where the code might appear.
1) header of the header code
Personal advice in your PHP should add the following sentence (except for special headers)
Copy CodeThe code is as follows:
Header ("Content-type:text/html;charset=utf-8");
This avoids some problems. For example, we can see that some websites submit a alert and then jump. But they didn't set the code. If his code is inconsistent with the browser's default encoding. It will appear garbled.
You are pure HTML. Be sure to put the META tag in front of the title tag. If you don't understand it, remember to put the encoded information in the first line of the head tag. The end result is this.
Copy CodeThe code is as follows:
...
2) encoding of the file
When we save the file, select the encoding must be unified. If you follow the above. We should choose UTF-8.
The general editor has encoded information for this file. If you find it is not UTF-8. Please change it immediately.
For example, we open a template file in Dreamweaver. Find the lower right corner of the GB2312 (English). Do not make any changes at this time. Ctrl+j then select the encoding to change to UTF-8 mode and save.
The encoding of a file is not necessarily a PHP file. Also make sure that your JavaScript files and CSS files are UTF-8 encoded.
There is another important point. is the BOM. This stuff PHP is not very welcome. So we have to choose UTF-8 No BOM format when saving. If you are using an editor that is UE. So please pay attention to this point.
3) Encoding of the database
I don't want to say more about it. There are too many articles on the Web. If you are MySQL, remember to set NAMES = ' utf8′ after each connection. And there is no horizontal line in the middle of the UTF8.
2.MVC problem
The programmer should theoretically be a perfectionist. They don't just want to write the program and run it. but also elegant.
But then again, after the program has been done according to MVC, is our code elegant? The answer is, of course, negative.
Learning architecture is a process of understanding. When you really appreciate the benefits of this architecture, you will understand what it really means. Never be blind.
Sometimes we do this. Use this month's time to learn about MVC. Well, I think you should do it. You learned to set goals for yourself.
But after one months, we may not really understand MVC. But at least we'll base his model on his basic. In other words, we may not learn the sunflower treasure. But we should be able to use evil sword.
3. Object-oriented issues
About PHP Object-oriented issues. has been entangled. Some people don't think that PHP object-oriented is a good thing. Some people don't even think object-oriented is a good thing, like Linus.
We don't have to dwell on this thing. At least we should know from the object-oriented birth to the present. After all these years of evolution. We have reason to believe that existence is justified.
Practice is the only criterion to test truth. For so many years object-oriented development situation is better. It seems that we have to learn to become a must.
Similar to the knowledge of some architectures. Object-oriented is not so studious. Object-oriented is a kind of idea. But when it comes to a particular language. There are some subtle changes in its meaning.
PHP's object-oriented is very flexible. With its unique magic method. It will create a special situation of the object-oriented. Maybe this is not the same as the object you normally see in Java.
Not necessarily putting the method you need into a class is object-oriented. When you really realize that object-oriented coding brings you quick and easy. You have a deeper understanding of object-oriented.
It is the so-called haste to waste. Don't be impatient. You want to understand relativity in a few days. That's pure nonsense.
4. Problems with the algorithm
It seems that PHP and algorithms are always very far apart. Most of PHP's algorithms are based on arrays. And we know that the nature of the PHP array is doomed when the array becomes very large. Efficiency will fall straight down.
In fact, PHP is a Web site. You don't have to give her a high hat. There are very few places in the web that will involve algorithms, especially in the context of the front end that PHP serves.
PHP's algorithm surface test is nothing more than an array or the operation of a string. Add a manual to your brain. That's basically fine.
Then you might ask. I want to learn PHP. Do I still learn the algorithm?
I think you need to learn. And more need to learn the data structure. The subject is like an internal strength. It will affect your coding in a subtle way.
At this time to cooperate with the evil spirits in front of us. Congratulations you have learned sunflower treasure!
5. Problems with the framework
PHP's framework is the most in a variety of languages. Use no frame. This becomes a controversial topic.
My suggestion is that it is highly recommended to learn at least one framework. This can deepen your understanding of PHP. We learn the framework not to learn how to use the framework. How to do the project.
We're going to see the source code. See how he came to be. You can then choose to develop a small framework yourself. Don't ask for a lot of other projects to use.
We're just trying to learn.
6.JavaScript problem
I can say that I have read so many languages. The most magical thing is JavaScript. Java has always claimed to be the object of everything. In fact, I think JavaScript is the object of everything.
is JavaScript studious? Easy to learn! In fact, in peacetime Web application time. The general JavaScript operation is DOM operations.
is JavaScript difficult to learn? Hard to learn! If we are bound by the object-oriented thinking of other languages. It is difficult to understand the object-oriented JavaScript. And there are many concepts in JavaScript.
Prototype arguments call apply callee caller closures and other concepts let us at a loss. Coupled with the quirky JavaScript code style and its difficult to debug features directly lead us to avoid the novice and far.
I once forwarded a code to implement Document.ready. Its strange degree has to admire.
Personally think that some JavaScript framework of the source code is the best way to learn. I used to write my PHP framework. Because of the use of the unified Portal + its own defined URL rules. You will not get parameters when you use a form with a normal property of get.
That's when I thought about the Formserialize method in Jquery.form. Pick it up and make some changes. You can use it.
7.CSS problem
What I do with CSS is separate from JavaScript. I think CSS learning is more characteristic.
I actually want to say that CSS is the simplest thing. We just know some basic CSS properties. Writing a page is definitely not a problem.
The main feature of CSS is that it has to be hands-on. You see the Book of N-CSS is better than actually writing a page.
Another feature of CSS is that you have to try more. Perhaps this attribute does not achieve your effect. Then you change it. That's the stupidest and most effective way:-)
This is, of course, just the primary CSS requirement. After that, we have to be compatible with the browser. In fact, this is not difficult to just a few browsers open a property at the same time a property of the test.
You can also memorize some hack such as IE6 know _ ie all know * and so on. If you think this is not standard enough to write CSS. Then put the hack in a different CSS file. For example, IE6 is called IE6.CSS.
Then you can use the following code on the page.
Copy CodeThe code is as follows:
The more advanced of course is the user's experience and design. I don't know about that either. @_@ hope to add to the talent.
8.linux problem
It is highly recommended that a Linux system be installed on everyone's computer. If you feel too frustrating you can choose the Wubi way to install Ubuntu. This is the simplest and most effective method for lazy people.
When you are bored, you can download a PHP source code to try it yourself. Avoid apt-get. Because often the server version is not Rhel or CentOS. There is no such command.
And the apt-get is often not the latest version. And can not be customized.
Linux always appears to be such a puzzling problem. For example, the environment is slightly different, the compilation does not pass. The service does not work.
Don't worry at this time. Look at the error message to see the log. Google to try to solve itself.
After compiling, don't feel like you're done. Try different configurations. and modify the source code and then try to compile.
For example, we downloaded a copy of the Nginx source code. Then modify the next header in the first place. You can compile a copy of your own HTTP WEB server.
Of course, if you call BWS or GWS.:-)
There's one more question. Does Linux need to recite commands? This is understandable. Memorizing some commonly used commands can improve speed. I need to reflect on this. Often some common commands need to look at the following parameters:
The other one is the shell problem. The shell is not difficult, but the syntax seems ugly to me @_@. Look at the wiki to learn more than half. It has to be the main link. We can see a phenomenon. Some companies in the recruitment of senior Phper This article is also listed as a necessary condition.
In fact, there is a lot of information on Linux online. Most of the problems you encounter will be met by others. So good at Google. and familiar with English.
9. Problems with the language
This problem is too much to water fights. No one has conquered anyone at the end. We don't have to take part in these silly things. These are young dung to do.
You have Linus B do you have cow B? He sprayed C + + spray for so many years. How's C + +?
So we don't have to dwell on that. Do what you do, OK.
Now that you've chosen PHP, don't hesitate.
Maybe when we were doing the project, PHP didn't seem to be enough. Then we can use Java or C to make a middleware. That's not the point.
It is the truth that a language plays her greatest and most use.
10. The question of attitude
Attitude must be modest. This is the virtue that a programmer should have. Never inflate yourself.
The more you learn, the more you will find yourself deficient.
You can say some arrogant things when you get the Bull B. But now we're not. B. At least if you see the article I wrote. You're not going to be very good. B. I said this article is for beginners:-)
11. Women's problems
Uh.. This is your own solution, @_@.
http://www.bkjia.com/PHPjc/322484.html www.bkjia.com true http://www.bkjia.com/PHPjc/322484.html techarticle As an intermediate Phper rookie. Bored to love in the various PHP forum blind turn. See a lot of PHP beginners have asked many of the same questions. And I've all met when I was learning PHP. In order to make ...