Why is PHP the preferred Web development language? -Php Tutorial

Source: Internet
Author: User
Tags zend framework
Why is PHP the preferred Web development language? Why is PHP the preferred Web development language?

2016.01.08 22:59:56

I don't know when to start. the programmer gave PHP the consistent ridicule and called it a "God Language". In addition, PHP is always named as a poor name with "messy code" and "many vulnerabilities. PHP should be the preferred Web development language in my Web development technologies such as Rails, ASP. net mvc, Java Web, Django, Sinatra, and PHP. Please note that the "first choice" here is not the "best" meaning, but the technology that should be given priority in the development tool stack learning selection process.

Why? There were a lot of reasons in my head. let's sort it out:

  1. PHP is born for the Web. it naturally has a close affinity with HTML and JavaScript, that is, the native flavor. Even if PHP and HTML code are mixed, from a certain point of view, it can help beginners intuitively understand the Web technical mechanism. bad things are sometimes good. On the other hand, the C style and Unix/Linux of open-source PHP give them excellent performance on Web application servers such as Apache and Nginx.In short, PHP and Web are a natural combination.
  2. To master PHP, I suggest starting with the much-criticized "messy code" programming style, perhaps from PHP and HTML mixed programming. After a thorough understanding of Web development technology, consider code organization and structure refactoring to help you grasp Web secrets in a more native way. So what is a more native approach? For example, a typical 404 status code.

    PHP implementation:

    404. php

       

    404. html

        
           

    404 page.

    Let's take a look at the implementation in ASP. net mvc:

    public ActionResult Details(int id){    return HttpNotFound();}

    Although well encapsulated, we know from the PHP method that the implementation in ASP. net mvc is indeed not abstract and intuitive, and is directly defined and redirected in the controller. In PHP, it is obvious that the header in the Code has the following meanings: HTTP-Version, Status-Code, and Reason-Phrase.

    By the way, the processing method in Rails is very abstract:

    render :template => '......', :status => 404
  3. JSP is similar to PHP, but JSP often needs to be used together with other JEE technical modules. The system is large enough and requires long-term preparation. Other frameworks such as ASP. net mvc and Rails have a high degree of abstraction and are not recommended as the first choice.

  4. I have to mention Node. js. Node. js is currently a very popular technology, known as the hope of "full stack". it is often used to argue with PHP about concurrency, threads, processes, and so on. I have no intention to comment on the advantages and disadvantages here, but at least PHP allows you to master one more technology, not just JavaScript. In addition, mature application cases of PHP's large businesses are everywhere.

  5. So should we always stick to the "messy code" method? Of course not. PHP provides strong OOP features. when the skills and understanding reach a certain level, code can be organized in OOP mode. In the PHP field, there are many frameworks, such as Laravel, CI, FuelPHP, Yii, Symfony, and Zend Framework. you can select either of them for standardized development. The key to "messy code" is not the tool itself, but the person himself! You must know that you can also write bad code in Java.

  6. PHP is rich in materials.

  7. Finally, I had a slightly digression. Previously, I still felt that the RESTful Web Services were using the standard HTTP method (GET/PUT/POST/DELETE) to abstract Web service capabilities, the focus of the server will be moved to MC, while the application of the server view template will decrease, and the client support requirements will increase. For example, various front-end databases and frameworks will be quickly promoted, and more demands will be handled at the front-end. But now I feel that this kind of status is too ideal, just like the scenarios where data is frequently changed and processed, it is more suitable for the server (such as the template engine) to complete, another example is the paging of a large amount of data. If all pages are implemented in a browser, the performance will certainly be very high. In addition, frequent Ajax calls and the absence of client cache mechanisms will also cause various problems. Further, SPA is not suitable for every business scenario,Server view templates are applicable in many fields.

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.