我如何在c#项目中使用php代码 [英] Hows Can i use php code inside my c# Project

查看:61
本文介绍了我如何在c#项目中使用php代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,
我正在c#项目上工作,我在Php中有一些API代码.我想在我的c#项目中使用那些php代码.任何朋友知道我如何在我的c#项目中使用php代码吗?

Hello Friends ,
i m working on c# Project & i have some API Codes in Php.i want to use those php codes in my c# Project.is any budy know how can i use php codes in my c# Project?

推荐答案

[
This[^] blog may help.


我认为您不能直接在C#项目中使用PHP代码,至少不能在Visual Studio中使用.

但是,您可以基于PHP代码创建一个单独的.NET程序集,并在您的C#项目中引用该程序集或项目(无论是否为ASP.NET,都没有关系).

为此,PHP编译器称为Phalanger:
http://en.wikipedia.org/wiki/Phalanger_(compiler) [ ^ ],http://php-compiler.net/doku.php [
I think you cannot use PHP code in C# project directly, at least not with Visual Studio.

However, you can create a separate .NET assembly based on PHP code and reference this assembly or project in your C# project (ASP.NET or not, does not matter).

The PHP compiler to do that is called Phalanger: http://en.wikipedia.org/wiki/Phalanger_(compiler)[^], http://php-compiler.net/doku.php[^]; it is free. Visual Studio integration is also available.

The ability to use Visual Studio integration allows to work under debugger, so this is also a good tool to debug PHP code that later can be used for writing traditional PHP web pages (not based on ASP or ASP.NET).

—SA


这篇关于我如何在c#项目中使用php代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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