在一个网页文件中使用一个以上的脚本语言 [英] use more that one scripting language in a web page file

查看:147
本文介绍了在一个网页文件中使用一个以上的脚本语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在一个网页的单个文件中使用一个以上的脚本语言?
例如,我想用Python和PHP醚在我的网页?
是否有可能或不?
我的意思是,有蟒蛇一个模块来解析这样的文件?或其他Web服务器上的任何可能性?
事情是这样的:结果

Is it possible to use more that one scripting language in a single file of a web page? For example, I want to use python and ether php in my web page? Is it possible or not? I mean, have python a module to parse files like this? or any possibility on other web servers? Something like this:

[文件Erfankam.ppp]

[File Erfankam.ppp]

<php script part>
    Some thing in php
</php script part>

<html part>
    something in html
<html part>

<python script part>
    Some thing in python
</python script part>

<html part>
    something in html
<html part>

<perl script part>
    Some thing in perl
</perl script part>

我希望我是没有错的。

I hope I was not wrong.

推荐答案

您可以使用Python返回,这是这是然后,再由PHP处理器处理一个PHP脚本的响应。但是,这将永远是一个渐进过程。因此,每个阶段将通过不同的间preTER处理。

You could use Python to return a response that was a PHP script which was then further processed by the PHP processor. But it would always be a sequential process. So each stage would be handled by a different interpreter.

我不能想象一个很好的理由这样做。

I cannot conceive of a good reason to do this.

在另一方面,你当然可以成为包含PHP和Python脚本的网站。针对不同资产的要求可以通过Python或PHP来处理。这是很容易的配置Web服务器时的实现。

On the other hand you could certainly serve a site that contained both PHP and Python scripts. Requests for different assets could be handled by either Python or PHP. This is easy enough to achieve when configuring a web server.

这将有可能写一些解析器是寻找特定的标记,然后用正确的跨preTER处理这些标签里面的code。但同样不知道你为什么会想这样做。一些实际的用例可能是有趣的。

It would be possible to write some kind of parser that looked for specific tags and then processed the code inside those tags using the correct interpreter. But again not sure why you would want to do this. Some actual use cases might be interesting.

在这里看到这个答案对于如何从PHP脚本中启动的Python / Ruby的一个例子 - <一个href=\"http://stackoverflow.com/questions/4619996/how-to-run-ruby-python-scripts-from-inside-php-passing-and-receiving-parameters\">How从PHP里面传递​​和接收参数运行Ruby / Python的脚本?

See this answer here for an example of how you can launch Python/Ruby from within a PHP script - How to run Ruby/Python scripts from inside PHP passing and receiving parameters?

这篇关于在一个网页文件中使用一个以上的脚本语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆