Home >Backend Development >PHP Tutorial >In a PHP project using requirejs, if PHP returns some JavaScript code, where should it be placed?
If I use requirejs in the front end of my php project,
If some php code will return some javascript code snippets that need to be run, where should I put these returned codes? Or how to deal with them?
Always feel that if you spread it out, it will be messy and difficult to maintain?
Or is my handling of php returning javascript code something that shouldn't happen?
My understanding of requirejs is that a page only needs to introduce one js, and this js will handle all things. I don’t know if this is the right understanding, please give me some advice.
I am new to 2333 and have never seen much of the world. Please give me some advice~
If I use requirejs in the front end of my php project,
If some php code will return some javascript code snippets that need to be run, where should I put these returned codes? Or how to deal with them?
Always feel that if you spread it out, it will be messy and difficult to maintain?
Or is my handling of php returning javascript code something that shouldn't happen?
My understanding of requirejs is that a page only needs to introduce one js, and this js will handle all things. I don’t know if this is the right understanding, please give me some advice.
I am new to 2333 and have never seen much of the world. Please give me some advice~
requirejs is an implementation of the AMD modular specification. As far as my development experience is concerned, requirejs is currently used less often, and is generally developed based on the npm ecosystem, that is, the CommonJS specification, or modularization based on the ES6 Module specification. method, and as the author said, returning js code snippets has never been encountered before.