简体   繁体   English

输入到C#中的控制台应用程序

[英]Input to console application in C#

I created a dll file for my matlab program. 我为我的matlab程序创建了一个dll文件。 I integrated it into C# console application now I have to call this console application from php. 我将其集成到C#控制台应用程序中,现在我必须从php调用此控制台应用程序。 The user selects an image whose imagepath should be passed as input in the C# console application. 用户选择应该在C#控制台应用程序中将其图像路径作为输入传递的图像。

I checked the console application my defining an image path and it works fine how can I program it to accept input from php aplication so that I can call exec(exepath imgpath)in php. 我检查了控制台应用程序,并定义了图像路径,该方法很好用,如何对它进行编程以接受来自php复制的输入,以便可以在php中调用exec(exepath imgpath)。 I have to pass the image path to the matlab dll file too. 我也必须将图像路径传递给matlab dll文件。 My Console application is: 我的控制台应用程序是:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using shoesddl;
using MathWorks.MATLAB.NET.Arrays;
using MathWorks.MATLAB.NET.Utility;


namespace shoes_describe
{
    class Program
    {
        static void Main(string[] args)
        {
            shoesddl.shoes_describe obj = new shoesddl.shoes_describe();

            MWArray img= "C:/Users/adithi.a/Desktop/dressimages/T1k5aHXjNqXXc4MOI3_050416.jpg";
            obj.shoes(img);
        }
    }    
}

I need the imgpath ie img in the above program from php. 我需要php的上述程序中的imgpath即img。 How can I achieve it? 我该如何实现?

use Command Line Parameters . 使用命令行参数 Your method is accepting parameters in string[] args . 您的方法接受string[] args You can pass the image path alongwith the exe name, from your PHP code. 您可以从PHP代码传递图像路径以及exe名称。

> exepath imgpath

That imagepath would available at args[0] imagepathargs[0]处可用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM