通过 PHP 与 C# 应用程序交互
最近我一直在考虑将 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
类似于 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.