如何在
我有一个用 PHP 编写的漂亮的大型开发工具包,但我当前正在开发的应用程序是用 CFML 编写的。
为了避免重写 PHP,我将尝试将 PHP 包装在 CF 标记中,并在需要时调用 PHP 函数。
有谁知道如何在 CF 中内联调用这些 PHP 函数之一?
I have this nice big Dev Kit written in PHP, but the application I'm currently developing is in CFML.
In an attempt to avoid rewriting the PHP, I'm going to try to just wrap the PHP in CF <script>
tags and call the PHP functions when I need them.
Does anyone have any idea how to call one of those PHP functions inline in CF?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
没有内置的方法可以做到这一点,但是使用 CFGroovy(它允许您内联任何符合 Java Scripting API 的语言实现)和 Quercus(Java 中的 PHP 实现),您也许能够实现您想要的/
CFGroovy : http://www.barneyb.com/barneyblog/projects/cfgroovy2/
栎属:http://www.caucho.com/resin-3.0/quercus/
简单的例子,包括源代码:
http://www.barneyb.com/cfgroovy2/
There's no built-in way to do this, but using CFGroovy (which allows you to inline any Java Scripting API-compliant language implementation) and Quercus (a PHP implementation in Java), you may be able to pull off what you want/
CFGroovy: http://www.barneyb.com/barneyblog/projects/cfgroovy2/
Quercus: http://www.caucho.com/resin-3.0/quercus/
A simple example including source code:
http://www.barneyb.com/cfgroovy2/
你不能。这是一个完全不同的应用程序引擎。您可以使用 CFHTTP 来调用 PHP 页面 - 但这有点矫枉过正。您可以在此处查看 Sean 的解决方案:
http://corfield.org/entry/ColdFusion_8_running_PHP
You can't. It's a whole other app engine. You could use CFHTTP to call a PHP page - but it's a bit overkill. You can look at Sean's solution here:
http://corfield.org/entry/ColdFusion_8_running_PHP
爱德华·M·史密斯是对的。您可以使用 Resin 作为 JVM 来混合 PHP 和 CFML。虽然我还没有这样做,但我确实相信 Resin 可以在与 CFML (ColdFusion) 网站相同的上下文中解释您的 PHP 代码。
.cfm/.cfc 不能包含任何 PHP,.php 文件不能包含任何 CFML/CFScript;
但是,这些文件可以在您的 www.something.com 域中并存。
Resin http://www.caucho.com/ 是一个 Web 服务器/PHP 解释器,速度非常快并且用Java编写的。它是开源 CFML 项目 Railo 的捆绑 JVM。
希望这有帮助。
Edward M. Smith is right. You may be able to mix PHP and CFML by using Resin as your JVM. While I have not done so, I do believe it is possible to have Resin interpret your PHP code from within the same context as a CFML (ColdFusion) Web site.
A .cfm/.cfc could not contain any PHP and a .php file could not contain any CFML/CFScript;
however, those files could live side by side within your www.something.com domain.
Resin http://www.caucho.com/ is a Web Server/PHP Interpreter that is very fast and written in Java. It is the bundled JVM for the open source CFML project Railo.
Hope this helps.
您可以通过 php/coldfusion 存储/检索客户端数组或变量来来回传递数据。
另一种选择是强制 Coldfusion 解析 .php 文件,以了解其中的任何 Coldfusion。它如何处理 Coldfusion 和 php 的混合,我不确定......
You can pass data back and forth by having php/coldfusion store/retrieve client array's or variables.
One other choice is to force coldfusion to parse through .php files, for any coldfusion inside there. How it would handle the mixture of coldfusion and php, I am not sure...