本文整理匯總了PHP中CLISetup::hasReadline方法的典型用法代碼示例。如果您正苦於以下問題:PHP CLISetup::hasReadline方法的具體用法?PHP CLISetup::hasReadline怎麽用?PHP CLISetup::hasReadline使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CLISetup
的用法示例。
在下文中一共展示了CLISetup::hasReadline方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: init
public static function init()
{
self::$win = substr(PHP_OS, 0, 3) == 'WIN';
self::$hasReadline = function_exists('readline_callback_handler_install');
if ($_ = getopt('d', ['log::', 'locales::', 'mpqDataDir::', 'delete'])) {
// optional logging
if (!empty($_['log'])) {
self::$logFile = trim($_['log']);
}
// alternative data source (no quotes, use forward slash)
if (!empty($_['mpqDataDir'])) {
self::$srcDir = str_replace(['\\', '"', '\''], ['/', '', ''], $_['mpqDataDir']);
}
// optional limit handled locales
if (!empty($_['locales'])) {
// engb and enus are identical for all intents and purposes
$from = ['engb', 'esmx'];
$to = ['enus', 'eses'];
$_['locales'] = str_ireplace($from, $to, strtolower($_['locales']));
self::$locales = array_intersect(Util::$localeStrings, explode(',', $_['locales']));
}
if (isset($_['d']) || isset($_['delete'])) {
self::$tmpDBC = true;
}
}
if (!self::$locales) {
self::$locales = array_filter(Util::$localeStrings);
}
// restrict actual locales
foreach (self::$locales as $idx => $str) {
if (!defined('CFG_LOCALES') || CFG_LOCALES & 1 << $idx) {
self::$localeIds[] = $idx;
}
}
}