我正在阅读本教程。
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?