实际场景是:已经具有的是一个用 C# 编写的比较复杂的程序(非 Web 程序,实现了一些算法),现在有个 PHP 网站,我需要将这个 C# 应用程序嵌入到 PHP 网页中使用。搜了很多结果,都说编译成 dll 后供 PHP 调用,但是 web 应用需要兼容Linux 和 Windows 系统,如果用 dll,linux下好像不可以吧。求问大神们还有什么更好的方法吗,跪谢~
回复讨论(解决方案)
能被 php 调用的外部程序是一定没有用户交互的(用户不可能跑到你的服务器上去点一下鼠标或按几个键)
所以说编译成 DLL 是没有错的
至于能否在 Linux 中运行 C# 程序,据说是可以的,但要安装一个什么软件
不过 C# 需在 .net 环境中运行,效率要比 C++ 低的多。既然你能用 C# 写,为何不改用 C++ 呢?反正没有界面,C#的优势也不在了
能被 php 调用的外部程序是一定没有用户交互的(用户不可能跑到你的服务器上去点一下鼠标或按几个键)
所以说编译成 DLL 是没有错的
至于能否在 Linux 中运行 C# 程序,据说是可以的,但要安装一个什么软件
不过 C# 需在 .net 环境中运行,效率要比 C++ 低的多。既然你能用 C# 写,为何不改用 C++ 呢?反正没有界面,C#的优势也不在了
谢谢一楼的解答。是这样的,我只是对现有的PHP系统进行二次开发,而且要求将别人研究出来的(C#编写的)算法嵌入到里面应用。算法比较复杂庞大,改写不太切合实际,而且要求以后有新的研究可以更换算法模块。
PHP肯定要与C#写的算法之间进行传参,并且取回得到的结果,我之前也看到说是Linux下要安装某个软件就可以使用,但是很不稳定,缺陷很多。
作为一个二手的程序猿,我只能说,我会在C#中加入一个web接口,将算法花一点时间改成http协议的api,返回json,然后用php的curl去调用,简单粗暴
那你就不要去照顾 Linux 了,老老实实的在 windows 中工作
估计无法实现,C#那玩意不想跨平台啊。
c#提供接口啊
以 http + json 和php做交互
C#在linux比较麻烦的。换个思路吧。
用C#写个web,然后使用http访问调用。
那你就不要去照顾 Linux 了,老老实实的在 windows 中工作
谢谢版主,搜了好多资料,最终也只能这样了,像你说的只考虑windows系统吧。现在只能把其他的模块做成兼容的,这个模块就只针对windows了,按时完成毕设才比较重要,谢谢啦
作为一个二手的程序猿,我只能说,我会在C#中加入一个web接口,将算法花一点时间改成http协议的api,返回json,然后用php的curl去调用,简单粗暴
恩,谢谢,思路很详细,非常感谢

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor
