我尝试访问wordnet字典,如Calling wordnet from php (Wordnet class or API for PHP)中所述。它通过命令行工作得很好。然后我尝试使用php函数shell_exec()访问字典,如下所示:
<?php
$output=shell_exec("\Program Files (x86)\WordNet\2.1\bin\wn");
echo $output;
?>这将显示搜索选项,如-ant、-hyp等。即,它工作正常
但是,当我尝试在上面的命令中添加搜索选项时(如下所示),它不起作用:
<?php
$output=shell_exec("\Program Files (x86)\WordNet\2.1\bin\wn star -synsn");
echo $output;
?>或者甚至当我在命令中留出空格时也是如此:
$output=shell_exec("\Program Files (x86)\WordNet\2.1\bin\wn ") 它没有起作用。
你能告诉我为什么会这样吗?有什么建议吗?
发布于 2011-06-16 04:53:53
好的,我得到了now.the问题的解决方案,因为command.So之间的空格,我按如下方式处理它们:
$cmd = '"C:/Program Files (x86)/WordNet/2.1/bin/wn" "home" "-synsn"';
$output=shell_exec($cmd);感谢所有回复我的问题的人
https://stackoverflow.com/questions/6355303
复制相似问题