dict.php
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 140 行
PHP
140 行
#!/usr/local/bin/php -q<?php// {{{ includesrequire 'Console/Getopt.php';require '../Dict.php';// }}}// {{{ get options$longOptions = array('help', 'match=', 'databases', 'strategies', 'info=', 'server', 'status');$con = new Console_Getopt;$args = $con->readPHPArgv();// array_shift($args);$options = $con->getopt($args, '', $longOptions);if (PEAR::isError($options)) { die($options->getMessage());}// }}}// {{{ help!function help(){echo <<<HELPUsage: dict [OPTIONS] keywordOptions: --help Prints this help screen --matches=word Show DB matches for word --databases Show DB list --strategies Show Strategy list --info=DATABASE Show Info on DB --server Show Server Info --status Show StatusHELP; exit(0);}if ('--help' == $options[0][0][0] or ( empty($options[0][0][0]) and empty($options[1][0]) ) ) help();// }}}// {{{ connect$d = new Net_Dict;$conn = $d->connect();if (PEAR::isError($conn)) { die($conn->getMessage());}// }}}// {{{ defineif (!empty($options[1][0])) { foreach ($options[1] as $keyword) { $defs = $d->define($keyword); if (PEAR::isError($defs)) { die($defs->getMessage()); } foreach ($defs as $def) { echo $def['definition']; } }}// }}}// {{{ options switch ($options[0][0][0]) { case '--help': help(); break; case '--match': foreach($d->match($options[0][0][1]) as $matches) echo $matches['database'] . ' : ' . $matches['word'] . "\n"; break; case '--databases': foreach ($d->showDatabases() as $db) echo $db['database'] . ' : ' . $db['description']."\n"; break; case '--strategies': foreach ($d->showStrategies() as $strat) echo $strat['strategy'] . ' : ' . $strat['description'] . "\n"; break; case '--info': $info = $d->showInfo($options[0][0][1]); if (PEAR::isError($info)) die($info->getMessage()); echo $info; break; case '--server': $server = $d->showServer(); if (PEAR::isError($server)) die($server->getMessage()); echo $server; break; case '--status': echo $d->status(); break; default: break;}// }}}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?