douyi7055
2018-01-17 10:19
浏览 130
已采纳

如何在wamp服务器上使用Tesseract PHP包装器

I used composer to install this Tesseract PHP wrapper : https://github.com/thiagoalessio/tesseract-ocr-for-php by typing the following command line directly from my php project folder located at C:/wamp/www/project_folder:

$ composer require thiagoalessio/tesseract_ocr

I created a php file called 'new' in the same folder where i try to use tesseract by typing :

use thiagoalessio\TesseractOCR\TesseractOCR;
echo (new TesseractOCR('text.png'))
->run();

I get the following error :

Fatal error: Class 'thiagoalessio\TesseractOCR\TesseractOCR' not found in C:\wamp\www\project_folder ew.php on line 4

Here's the content of my project folder :

   vendor(a folder)
   composer.json 
   composer.lock
   new.php 
   test.png 

I have wampserver version 2.5 I have already installed tesseract (version 4) at C:program files I included the following code to my php file in order to set the path but still encoutering the error.

$path = getenv('PATH');
putenv("PATH=$path:C:\Program Files\Tesseract_OCR");

图片转代码服务由CSDN问答提供 功能建议

我使用composer来安装这个Tesseract PHP包装器: https://github.com/thiagoalessio/tesseract -ocr-for-php </ code> 直接从位于 C:/ wamp / www / project_folder </ code>的php项目文件夹中键入以下命令行:</ p> <n pre> $ composer require thiagoalessio / tesseract_ocr </ code> </ pre>

我在同一文件夹中创建了一个名为'new'的php文件,我尝试使用tesseract键入: </ p>

 使用thiagoalessio \ TesseractOCR \ TesseractOCR; 
echo(new TesseractOCR('text.png'))
-&gt; run(); 
 </ code> <  / pre> 
 
 

我收到以下错误:</ p>

致命错误:在C中未找到类'thiagoalessio \ TesseractOCR \ TesseractOCR': 第4行\ wamp \ www \ project_folder ew.php </ p> </ blockquote>

以下是我的项目文件夹的内容:</ p>

 < 代码>供应商(文件夹)
 composer.json 
 composer.lock 
 new.php 
 test.png 
 </ code> </ pre> 
 
 

我有wampserver ve rsion 2.5 我已经在C:程序文件中安装了tesseract(版本4) 我将以下代码包含在我的php文件中,以便设置路径但仍然包含错误。 </ p>

  $ path = getenv('PATH'); 
putenv(“PATH = $ path:C:\ Program Files \ Tesseract_OCR”); 
 </ code> <  / pre> 
 </ div>

2条回答 默认 最新

相关推荐 更多相似问题