我在將base64編碼的圖像字符串傳遞給python腳本時遇到錯誤....那無法運行shell_execute(“ python hello.py $ data”)這是我的代碼php文件 <?php echo "Good Work"; $img = file_get_contents("aaaa.jpg"); $data = base64_encode($img); $output = shell_exec("python hello.py".$data); echo $output; ?>hello.py文件import sysimport base64image_64_encode=sys.argv[1]with open("image.jpg","wb") as fh: fh.write(base64.decodebytes(image_64_encode))`
是否有任何方法可以將圖像作為變量從php傳遞到python腳本
慕無忌1623718
2021-04-30 18:49:46