<?php
|
|
#$cmd = "/Users/iris/anaconda3/envs/venv/bin/python3.6 /Users/iris/im2latex_master2/demo2.py --test_data_path ".$_FILES['file']['tmp_name']." 2>&1 ";
|
|
|
|
if(!empty($_FILES['file']['name'])){
|
|
//判断是否有文件
|
|
$fileinfo = $_FILES['file']; //将文件信息赋给变量$fileinfo
|
|
if($fileinfo['size']<2000000 && $fileinfo['size']>0){ //判断文件大小
|
|
|
|
# if(move_uploaded_file($_FILES["file"]['tmp_name'],"image/".$fileinfo['name']))
|
|
# {
|
|
# $filepath="/app/image/".$fileinfo['name'];
|
|
|
|
#$cmd = 'cd /Users/iris/im2latex_master ';
|
|
#unset($out);
|
|
#$res=exec($cmd, $out);
|
|
#var_dump($res);
|
|
#echo '------';
|
|
#var_dump($out);
|
|
#echo '------';
|
|
unset($out);
|
|
$cmd = "python3 im2latex_master/demo2.py --test_data_path ".$_FILES['file']['tmp_name']." 2>&1 ";
|
|
|
|
$res=exec($cmd, $out,$return_status);
|
|
var_dump($out);
|
|
var_dump($return_status);
|
|
$data = json_decode($res, true);
|
|
echo $data['res'];
|
|
|
|
|
|
|
|
#ç '------';
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|