NoteOnMe博客平台搭建
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
998 B

3 years ago
  1. <?php
  2. #$cmd = "/Users/iris/anaconda3/envs/venv/bin/python3.6 /Users/iris/im2latex_master2/demo2.py --test_data_path ".$_FILES['file']['tmp_name']." 2>&1 ";
  3. if(!empty($_FILES['file']['name'])){
  4. //判断是否有文件
  5. $fileinfo = $_FILES['file']; //将文件信息赋给变量$fileinfo
  6. if($fileinfo['size']<2000000 && $fileinfo['size']>0){ //判断文件大小
  7. # if(move_uploaded_file($_FILES["file"]['tmp_name'],"image/".$fileinfo['name']))
  8. # {
  9. # $filepath="/app/image/".$fileinfo['name'];
  10. #$cmd = 'cd /Users/iris/im2latex_master ';
  11. #unset($out);
  12. #$res=exec($cmd, $out);
  13. #var_dump($res);
  14. #echo '------';
  15. #var_dump($out);
  16. #echo '------';
  17. unset($out);
  18. $cmd = "python3 im2latex_master/demo2.py --test_data_path ".$_FILES['file']['tmp_name']." 2>&1 ";
  19. $res=exec($cmd, $out,$return_status);
  20. var_dump($out);
  21. var_dump($return_status);
  22. $data = json_decode($res, true);
  23. echo $data['res'];
  24. #ç '------';
  25. }
  26. }