无法在php中执行python脚本

时间:2016-08-30 12:42:36

标签: php python pypi

从python脚本检索结果时遇到问题

我的php脚本如下:

<?php
   $cmd=escapeshellcmd('/opt/lampp/htdocs/adpNews/adpScripts/getArticle.py');
$result=shell_exec("python $cmd");
echo $result;                   
?>

我的Python脚本如下:

#!/usr/bin/env python
from newspaper import Article

url=u'http://www.abplive.in/india-news/countering-terrorism-an-important-shared-objective-by-india-united-states-manohar-parrikar-407134'

article=Article(url)
article.download()
article.parse()
print article.text

请给我解决方案

0 个答案:

没有答案
相关问题