how to execute php code within javascript

前端 未结 8 1808
無奈伤痛
無奈伤痛 2020-11-30 03:47



        
8条回答
  •  [愿得一人]
    2020-11-30 03:57

    Any server side stuff such as php declaration must get evaluated in the host file (file with a .php extension) inside the script tags such as below

    
    

    Then in the .js file, you can use the variable

    alert(var1);
    

    If you try to evaluate php declaration in the .js file, it will NOT work

提交回复
热议问题