如何读取从Codeigniter con传递的python文件中的数组

2024-09-21 01:16:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我想从codeigniter控制器发送一个数组,以便在python文件中接收进一步的执行。我已将数组传递给python文件,但无法在python文件中接收数组

编码点火器控制器

class Aanalysis extends CI_Controller
{

    public function __construct() {
        parent::__construct();
    }

    public function index()
    {
        $postData = array(
            'hashtag' => $this->input->post('hashtag'),
            'nooftweets' => $this->input->post('nooftweets')
        );

        $output = shell_exec("python main.py" $postData);
    }

}

Tags: 文件编码inputfunction数组publicthisconstruct
1条回答
网友
1楼 · 发布于 2024-09-21 01:16:28

您需要给出python文件/脚本的完整路径。 比如,system('/full/path/to/your_python_file.py'); 如果python文件存在于codeigniter项目所在的apache目录中,则不需要给出完整路径

相关问题 更多 >

    热门问题