dsc6517 2019-03-06 05:24
浏览 114

如何远程运行PHP解释器?

I'm trying to run php interpreter remotely in a html file. Basically the html file contains the php code which I want to execute it by using remote php interpreter via reference or something. I did it with other languages and it is working.

Like:

For JAVASCRIPT: (we directly write "javascript")

<script type="text/javascript">
  document.write("This is Javascript!")
</script>

For JQuery:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"> 
</script>

For ANGULARjs: (I'm not sure it might be...)

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"> 
</script>

Is there way to include the link for php too,
like something:

<script src="php.ini">

or

<script src="<path to php webserver of remote>">
</script>

Can anyone please tell me how it is possible or the way it can be get it done.

  • 写回答

1条回答 默认 最新

  • douyin2435 2019-03-06 05:36
    关注

    If you are using a server and you wish to execute php in an html file, you will need to tell your server to execute .html files as .php with apache2 you need to add the below code snippet to .htaccess in the current working directory or a parent one, this will make all .html files get handeled as if they where a php script

    AddType application/x-httpd-php .html
    

    I'm not entirely sure why you don't just use .php file extenstion, but hey there are many valid reasons...

    One thing to note, all of the languages you posted are javascript based, javascript is a client side language, whereas php runs on the server. There is a HUGE difference between how they work.

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!