How to call a php function within [removed] tag fr

2019-06-24 05:29发布

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?

4条回答
干净又极端
2楼-- · 2019-06-24 05:54

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.

查看更多
三岁会撩人
3楼-- · 2019-06-24 05:59

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

查看更多
爷的心禁止访问
4楼-- · 2019-06-24 06:01

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...

查看更多
时光不老,我们不散
5楼-- · 2019-06-24 06:02

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/

查看更多
登录 后发表回答