我正在使用此代码在 php 中获取图像大小,它非常适合我。
$img = get_headers("http://ultoo.com/img_single.php", 1);
$size = $img["Content-Length"];
echo $size;
Run Code Online (Sandbox Code Playgroud)
但是如何通过 CURL 获得它?我试过这个,但不起作用。
$url = 'http://ultoo.com/img_single.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, "Content-Length" );
//curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
$filesize = $result["Content-Length"];
curl_close($ch);
echo $filesize;
Run Code Online (Sandbox Code Playgroud) 我在我的Windows上使用Xampp.我想在PHP中使用Tesseract OCR
我的tesseract安装在
C:/Program Files/Tesseract OCR/
Run Code Online (Sandbox Code Playgroud)
和Xampp安装在
C:/xampp/
Run Code Online (Sandbox Code Playgroud)
M使用此代码执行我的PHP中的teseract
exec("tesseract test.png test.txt");
Run Code Online (Sandbox Code Playgroud)
但它不起作用......
请给我工作代码.