我正在阅读本教程。将ASP.NET代码转换为PHP
http://ben.onfabrik.com/posts/pagedown-markdown-editor-custom-image-dialog
在它的尽头有ASP.NET代码
[HttpPost]
public ActionResult EditorUpload(MediaEditorUploadModel model)
{
string result;
var serializer = new JavaScriptSerializer();
if (model.File.IsValidFile() && model.File.IsImage()) {
// upload the file
result = serializer.Serialize(
new { success = true, imagePath = "http://{the url of the uploaded image}"});
} else {
result = serializer.Serialize(
new { success = false, message = "Invalid image file"});
}
return Content(result); // IMPORTANT to return as HTML
}
但我不知道,我怎么必须PHP回应它。任何人都可以帮我把这段代码翻译成PHP吗?
无论如何应该对这个问题如何改进或者反对的理由留下评论。 – HeatfanJohn 2012-07-25 01:13:14
我没有downvote(但我投票结束,但是)。大多数人没有解释他们失望的原因是因为有很多人憎恶被低估,并立即降低了低估他们问题的人 - 青少年的行为使人们不愿意解释他们的低估。 (我自己曾多次发生过这种情况。)我投票结束,因为问题显示在发布之前绝对没有尝试找出它,而这不是代码翻译服务。我们很乐意提供帮助,但我们希望首先从问题海报中获得至少一些努力。 – 2012-07-25 01:58:45