PHP code inside a Javascript's “[removed]()”

后端 未结 5 931
广开言路
广开言路 2020-12-20 21:50

I need to write some PHP code inside a Javascript\'s \"document.write()\". This is a dummy example, but in the future Javascript will generate automatically tha

5条回答
  •  心在旅途
    2020-12-20 22:46

    If you need to execute some PHP code via javascript, you would need to have the PHP housed on a server somewhere where it can be run (i.e. the browser client will not run it) and then you need to used AJAX to run that script and do whatever you need to do with its output.

提交回复
热议问题