| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- /**
- * Created by PhpStorm.
- * User: chendeben
- * Date: 2017/12/6
- * Time: 11:50
- */
- namespace PhpLife\App\Api\Controller;
- use PhpLife\App\Api\Controller;
- use PhpLife\Frame\Logger;
- use PhpLife\Library\AipOcr;
- use PhpLife\Library\AipSpeech;
- use PhpLife\Library\Postgres;
- use PhpLife\Library\Sentry;
- class Aip extends Controller
- {
- public function main()
- {
- $this->baidu();
- // Logger::setLog("cdb@meitu.com","test2",'sentry');
- die();
- // var_dump(Postgres::getInstance()->count("t_article"));
- // $data=Postgres::getInstance()->select('t_article');
- $data=Postgres::getInstance()->postgres->count('t_article');
- var_dump($data);
- }
- public function baidu(){
- $word=$this->getQuery()->string("q",'你好!');
- $appId = "10537047";
- $apiKey = "7OzniBlSCMEjEouv61Ayeu2K";
- $secretKey = "adG7sz1UHrjbep4VvfTN4xrdLFjf9Aws";
- $baiduAip = new AipOcr($appId, $apiKey, $secretKey);
- $result = $baiduAip->basicGeneral(file_get_contents('/www/xjy.png'));
- var_dump($result);
- }
- public function test($count){
- $prev = 0;
- $current = 1;
- for ($i = 0; $i < $count; ++$i) {
- $next = $prev + $current;
- $prev = $current;
- $current = $next;
- yield $prev;
- }
- }
- public function xrange($start,$end,$step=1){
- for ($i = $start; $i <= $end; $i += $step) {
- yield $i;
- }
- }
- }
|