使用 php 访问 WordNet
我尝试访问 wordnet 字典,如下所述:调用来自 php 的 wordnet(PHP 的 Wordnet 类或 API)。 通过命令行它工作得很好。然后我尝试使用如下的 php 函数 shell_exec() 来访问字典:
<?php
$output=shell_exec("\Program Files (x86)\WordNet\2.1\bin\wn");
echo $output;
?>
这显示了搜索选项,如 -ant、-hyp 等。ie 它工作正常
但是当我尝试在上面添加搜索选项时命令(如下)它不起作用:
<?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 ")
它不起作用。
您能帮我看看这可能是什么原因以及解决方案的任何建议吗?
I tried to access the wordnet dictionary as mentioned in: Calling wordnet from php (Wordnet class or API for PHP).
It worked fine through command line. Then I tried to use the php function shell_exec() as below to access the dictionary:
<?php
$output=shell_exec("\Program Files (x86)\WordNet\2.1\bin\wn");
echo $output;
?>
This displays the search option like -ant, -hyp, and so on.i.e it worked fine
But when I tried to add the search option in the above command(as below) it did not work:
<?php
$output=shell_exec("\Program Files (x86)\WordNet\2.1\bin\wn star -synsn");
echo $output;
?>
or even when I gave space in the command like:
$output=shell_exec("\Program Files (x86)\WordNet\2.1\bin\wn ")
it did not work.
Can you please help me what may be the reason for this and any suggestion for the solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我现在得到了解决方案。问题是因为命令之间的空格。所以我按如下方式处理它们:
感谢所有回复我的查询的人
ok i got the solution now.the problem was because of the spaces between the command.So i handled them as below:
thanks to all who responded to my query