


javascript - I beg the master: How to best cooperate with the front and back ends
Produce dynamic php and jsp pages with data, and the front-end and back-end packaging and publishing are completely independent.
The advantage of this is the performance of the front-end layer. The data is completely controlled by the front-end.
Any problems can be solved independently by the front-end and packaged and released separately.
The packaging and release of front-end and back-end are completely independent. The meaning and understanding of this game
Reply content:
Produce dynamic php and jsp pages with data, and the front-end and back-end packaging and publishing are completely independent.
The advantage of this is the performance of the front-end layer. The data is completely controlled by the front-end.
Any problems can be solved independently by the front-end and packaged and released separately.
The packaging and release of front-end and back-end are completely independent. The meaning and understanding of this game
The front-end and back-end are separated, the front-end is engineered, and all interactions between the front-end and the back-end are through the API. You may think that this is not good for SEO, but now with nodejs, page rendering can be left to the front-end. In fact, this is also a trend. The end-end should care about system availability, performance and other issues, and should not focus on page issues. This part should be left to the front-end.
This blog should be able to help you develop ideas for separate front-end and back-end web development by livoras
First, determine the communication protocol and communication parameters.
Front-end independent jobs can use tools such as mock to simulate background data transmission.
Back-end design uses data models to complete business and generate interfaces.
Personally, I think it is similar to separating the view business such as the template engine in PHP from the project to form an independent front-end version?
The front and back ends interact through API. It doesn't matter whether you use the web front-end or the ios and Android client.
The backend should try to use the same API to meet the needs of multiple front-end pages or even different front-ends. This is the best. The front end needs to know what data is returned by the back end and how it should be rendered according to the design diagram.
A while ago I wrote an article on the steps to develop non-native APP using ionic and cordova on the front end and CoreThink on the back end http://www.oschina.net/question/2598464_2151690?fromerr=mCRfZH2m You can take a look
Simply put, separate the front and back ends through data interfaces (such as ajax requests).
Negative case
I took over a semi-formed web project last year: it was developed in the backend PHP language. I wouldn’t know it without looking at the code. When I looked at the code, I fainted. The code is basically as follows:
<?php ... echo val; ?> <html> <?php echo ...?> </html>
The entire php file contains the flavor of html. I won’t go into details, you should understand. Except for the css file, I threw up. Deeply hurt the heart of OCD. Language can still be used in this way. Once again I felt like I had chosen the wrong path. I thought the world of code could be more organized, but it seems I was wrong.
After thinking about it, I realized that if it was developed in this way, it would be hard enough for one person to cover both the front and back ends. However, this hybrid development model does have an advantage, which is low cost and high efficiency. There are a lot of shortcomings, and expansion and later maintenance are problematic.
Positive Cases
Last year, I also took over a web project. The main requirement: display the content in the background database table. To put it bluntly, it is to imitate the web control of MySQL. But it's simple. But there are requirements: Modeling, that is, by modifying a small number of parameters in the background, you can control the number of tables displayed on the front end, and even the column names of the tables. In other words, all information about the table on the front end is provided by the back end. The front-end only needs to make display adjustments to the interface based on the back-end data.
Design ideas:
1. The style of the table and the dynamic operation of the mouse on the table are used as part of the front-end module;
2. The table name information and list information of the table are returned to json by the ajax request server, and the json can be dynamically created locally by slightly verifying the json locally. Table;
3. Data acquisition also applies to ajax acquisition. Then populate the local table;
4. All local additions, deletions and modifications to data are uploaded to the server through ajax;
The only running-in point is the ajax interface. During development, due to the slowness of the backend, some interfaces passed fake data directly to the frontend through echo
.
Advantages of front-end and back-end separation
Through the development of the data interface model, the front-end and back-end are completely separated, and because this project is a model-based design, the code reuse is very high.
Moreover, if a problem occurs, by detecting the data in the data interface, it is easy to know whether it is a front-end problem or a back-end problem. It is very easy to maintain and even carry out in-depth secondary development.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.
