从python调用php脚本

时间:2018-08-07 07:15:37

标签: php python subprocess execution

有没有办法在python中执行php脚本?以及如何测试呢?因为我尝试使用子流程,但是它不起作用。输出为255

import subprocess

subprocess.call(["php","-f","01_getdata_input.php","bib_id_skjawasur_texts","bib_id_ayt_texts"])

我的php文件是这样的

<?php
require_once "libs/c_db.php";
require "libs/c_general.php";

$obj = new ProsesData();
$obj->proses($argv[0],$argv[1]);

class ProsesData
{
  private $table;

  public function __construct() {
    $this->db = new c_DB("localhost", "root", "", "skripsi");
    $this->libs = new c_General();
  }

  public function proses($data1,$data2) {
    echo $data1;
  }
};

0 个答案:

没有答案