【发布时间】:2019-07-25 14:51:19
【问题描述】:
$.ajax({
url: 'ajaxfile.php',
type: 'POST',
data: {
image: base64URL
},
success: function(data){
console.log(data);
$.notify("info", "Upload successfully");
},
error: function () {
$.notify("Error on image upload");
}
});
PHP 代码:
<?php
$image = $_POST['image'];
$location = "src/upload/";
$image_parts = explode(";base64,", $image);
$image_base64 = base64_decode($image_parts[1]);
$filename = "screenshot_".uniqid().'.png';
$file = $location . $filename;
file_put_contents($file, $image_base64);
return [
'status' => true
]
?>
调用已完成(我在浏览器控制台中看到),但在 console.log 上我返回了代码 php。似乎什么也没发生,代码php没有实现。你有想法吗?提前谢谢,对不起我的英语
我放了一张有错误的图片
【问题讨论】:
标签: php jquery jquery-ui nginx html2canvas