通过 PHP 与 C# 应用程序交互

发布于 2024-09-29 19:49:09 字数 658 浏览 0 评论 0原文

最近我一直在考虑将 C# 应用程序与网站结合起来,这样我们就可以在 C# 中运行多个线程,并在 PHP 所需的时间内完成更多任务 1。

我们大多数人都知道 PHP 在单线程上运行,因此我们不能同时执行多个操作

,但是如果我们可以执行以下操作,那就太好了:

$SharpEntity = new CSharpExecute();

$SharpEntity->add("downloader.class http://server.com/file.ext");
$SharpEntity->add("downloader.class http://server.com/file2.ext");
$SharpEntity->add("downloader.class http://server.com/file3.ext");

$SharpEntity->initialize();

while($SharpEntity->completed === false)
{
   $SharpEntity->Update();
}

echo 'Files Grabbed';

这只是一个基本示例,但实际上是否可以执行这样的操作?如果可以,您该如何执行此操作?

我知道 Facebook 和其他大型系统会做类似的事情,但是对于 C++,你们怎么看?

Recently I have been thinking combining C# applications with a website, so that we can run multiple threads in C# and complete more tasks in the time it would take PHP would to do 1.

Most of us know that PHP Runs on a single thread and therefor we cant do multiple actions at the same time

But it would be nice if we can do something like:

$SharpEntity = new CSharpExecute();

$SharpEntity->add("downloader.class http://server.com/file.ext");
$SharpEntity->add("downloader.class http://server.com/file2.ext");
$SharpEntity->add("downloader.class http://server.com/file3.ext");

$SharpEntity->initialize();

while($SharpEntity->completed === false)
{
   $SharpEntity->Update();
}

echo 'Files Grabbed';

This is just a basic example but would it actually be possible to do such a thing and if so, how can you do this?

I know that Facebook and other large systems do something like this but with C++, what you guys think?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

画尸师 2024-10-06 19:49:09

类似于 JSON(或 json 本身)的策略

将对象分解为字符串并将其映射到 C# 对象。
如果您自行使用 JSON,则可以使用一些已经提供的用于转换 Json 的 C# 帮助程序。

希望有帮助。

A strategy similar to JSON (or json itself)

break the objects down to strings and map it to a C# object.
If you go with JSON it self you can get away with using some of the C# helpers already provided for translating Json.

Hope that helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文