Tag: php

数组创建是否在每个foreach循环中发生?

我发现自己这样做: string states = “this,that,theother”; foreach(string state in states.Split(‘,’)) { } 我想知道; states字符串是否在每个foreach循环中被拆分? 这个例子在c#中,但其他编程语言的行为有何不同 ? PHP和JavaScript是否在每个foreach循环上拆分?

当Operations接受接口时,从PHP调用ASMX Web服务

我有一个.Net Web服务,它有一个接受我作为参数编写的接口的方法。 我们称这个接口为ICustomer。 你会如何从PHP调用这个方法? 方法定义是 [WebMethod] public string RegisterCustomer(ICustomer customer) { … }

.Net C#到PHP Pb with byte array&ComputeHash

我在.Net C#中有这个function,并希望在PHP中也这样做。 但我不明白所有的C#部分,也不确定我的代码。 public static string getMD5Hash(string input) { MD5 mD = new MD5CryptoServiceProvider(); byte[] array = Encoding.UTF8.GetBytes(input); array = mD.ComputeHash(array); StringBuilder stringBuilder = new StringBuilder(); int i = 0; byte[] array2 = array; int length = array2.Length; while (i < length) { stringBuilder.Append(array2[i].ToString("x2").ToLower()); i++; } return stringBuilder.ToString(); } 我找到了一个例子来描述如何从一个字符串(谁是相同的)创建MD5哈希: http : //en.csharp-online.net/Create_a_MD5_Hash_from_a_string 并找到了关于字符串到字节的SoFpost: 字符串到php中的字节数组 […]

Phalanger找不到我的php课程

在这个问题之后,我发现了一个很好的(最新的)示例。 我成功地让PHP.Core库在VS中工作,但仍然在查找我的php类时遇到问题。 然而,该教程很简单 dynamic phpObj = globals.@class.PhpClass(); 从来没有找到我的PHP课程。 我尝试过使用示例文件default.php(classname:PhpClass)和我自己的php类,它们类似,但名称不同。 我在这里想念的是什么? 我试过了这个选项 项目属性>打包/发布Web>要部署的项目>项目中的所有文件 但那并没有帮助。 目前我在项目下面有我的php课程,如下所示 我得到的错误只是说它找不到类: 在这里使用ILSpy是CurrentContext的主要代码片段 result = (((ScriptContext)CallContext.GetData(“PhpNet:ScriptContext”)) ?? ScriptContext.CreateDefaultScriptContext()); 这是用于查找php类(AFAIK)的代码行。

.NET POST到PHP页面

我正在尝试从我的C#.NET应用程序实现一个非常基本的系统,该系统将我的Web服务器上的机器的IP地址发送到authenticate.php。 php页面将针对数据库检查此IP地址,并以“是”或“否”回复。 自从我使用PHP以来已经很长时间了,我有点困惑。 这是我的.NET函数的样子。 public static bool IsAuthenticated() { string sData = getPublicIP(); Uri uri = new Uri(“http://www.mysite.com/authenticate.php”); if (uri.Scheme == Uri.UriSchemeHttp) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.Method = WebRequestMethods.Http.Post; request.ContentLength = sData.Length; request.ContentType = “application/x-www-form-urlencoded”; // POST the data to the authentication page StreamWriter writer = new StreamWriter(request.GetRequestStream()); writer.Write(sData); writer.Close(); // Retrieve response from […]

将图像从C#程序发送到PHP网页进行显示

我是C#的新手,我正在使用这段代码: //Take a snapshot from left camera and save to current directory as “snapshot.png” case Key.Z: int left = camLeft.Device.LensCorrection1; camLeft.Device.LensCorrection1 = 0; Thread.Sleep(150); BitmapSource bmpSource = camLeft.Device.BitmapSource as BitmapSource; MemoryStream ms = new MemoryStream(); BitmapEncoder encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(bmpSource)); encoder.Save(ms); ms.Seek(0, SeekOrigin.Begin); System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(ms); string filepath = Environment.CurrentDirectory; string fileName […]

使用PHP对XML文件进行数字签名

我需要使用私有RSA密钥签署一个XML文件,以便用我的C#应用​​程序进行validation。 当我用我的C#应用​​程序签署xml时,这是最终输出: VIRRzqwb20aCSXrRTX1Y5vW//IA= mS3JQ/KmyXCayLly4hHRXKM51jPy230B3h4ngjzOhq0xR/7BRDQP2wfp7ugVcL5kMWaV+pBHbJgdvvu8OrzyxCUQ+R7RYqWpEBYJHUARov0Pws7oFybFpmzRnwhg2gPaPEzcVpK4VL4G1iM07XgmoSKM8Id0fRQ1lD+4BEcAxNY= 登录C#: public static void SignXmlDocument(RSA key, XmlDocument doc) { var sxml = new SignedXml(doc); sxml.SigningKey = key; sxml.SignedInfo.CanonicalizationMethod = SignedXml.XmlDsigCanonicalizationUrl; var r = new Reference(“”); r.AddTransform(new XmlDsigEnvelopedSignatureTransform(false)); sxml.AddReference(r); sxml.ComputeSignature(); var sig = sxml.GetXml(); doc.DocumentElement.AppendChild(sig); } 我怎样才能在PHP中做同样的事情?

使用C#的POST方法使用数据进行PHP加密和解密

我正在尝试使用POST方法使用来自应用程序的密钥发送来加密字符串.POST方法发送加密密钥。但是脚本工作不正常请帮助我。

PHP和C#3DES加密

需要将以下函数从PHP转换为C#(asp.net) function encrypt_3DES($message, $key){ // Se establece un IV por defecto $bytes = array(0,0,0,0,0,0,0,0); //byte [] IV = {0, 0, 0, 0, 0, 0, 0, 0} $iv = implode(array_map(“chr”, $bytes)); //PHP 4 >= 4.0.2 // Se cifra $ciphertext = mcrypt_encrypt(MCRYPT_3DES, $key, $message, MCRYPT_MODE_CBC, $iv); //PHP 4 >= 4.0.2 return $ciphertext; } 其中$message是要编码的字符串, $key是键 $key是base 64编码的,在调用函数之前会被解码 […]

如何使用wpf webbrowser将数据发布到Web服务器

我想从数据库中获取数据并使用它来登录用户到网站。 我有一个wpf页面,其中包含Web浏览器控件。 我有这个代码,用户登录到用PHP编写的网站: <?php $user = $_GET['u']; $pass = $_GET['p']; echo "”; echo “”; ?> 我怎么能在wpf中这样做? 据我所知,我需要创建一个HTML并将其发布到网站。 我的问题: 1-如何在代码中创建这样的html? 2-如何自动将其提交到站点(假设我在wpf用户控件的构造函数上执行此操作)。