本文整理匯總了PHP中Setup::setCreateDatabase方法的典型用法代碼示例。如果您正苦於以下問題:PHP Setup::setCreateDatabase方法的具體用法?PHP Setup::setCreateDatabase怎麽用?PHP Setup::setCreateDatabase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Setup
的用法示例。
在下文中一共展示了Setup::setCreateDatabase方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: parseStringFromWebVar
}
/**
* Given an index in the POST var array, return a string version
*
* @param mixed $index The index of the POST var to parse.
* @return mixed String of value if value is set, null otherwise.
*/
function parseStringFromWebVar($index)
{
if (array_key_exists($index, $_POST) && isset($_POST[$index])) {
return (string) $_POST[$index];
}
return null;
}
$setup = new Setup();
$setup->setCreateDatabase(parseBoolFromWebVar('createdb'));
$setup->setUseRealKrb(parseBoolFromWebVar('realKrb'));
$setup->setSetupTempFolders(parseBoolFromWebVar('setuptmpfolders'));
$setup->setUseDevelopmentEnvironment(parseBoolFromWebVar('usedevelopmentenv'));
$setup->setUserInfo(parseStringFromWebVar('firstname'), parseStringFromWebVar('surname'), parseStringFromWebVar('username'), parseStringFromWebVar('email'));
?>
<?php
require './header.html';
?>
<p class="results">
<?php
$setup->run();
?>
<ul class="actions">
示例2: return
return (string) $array[$index];
}
return null;
}
$shortopts = '';
$shortopts .= 'd';
// If present, create the database
$shortopts .= 'h:';
// Users handle
$shortopts .= 'n:';
// Users firstname
$shortopts .= 's:';
// Users surname
$shortopts .= 'e:';
// Users e-mail
$shortopts .= 'f';
// If present, set-up the tmp folders
$shortopts .= 'v';
// If present, use development configs, settings and databases
$options = getopt($shortopts);
if (is_array($options)) {
$setup = new Setup();
$setup->setCreateDatabase(parseBoolFromArray('d', $options));
$setup->setSetupTempFolders(parseBoolFromArray('f', $options));
$setup->setUseDevelopmentEnvironment(parseBoolFromArray('v', $options));
$setup->setUserInfo(parseStringFromArray('n', $options), parseStringFromArray('s', $options), parseStringFromArray('h', $options), parseStringFromArray('e', $options));
$setup->run();
} else {
echo 'Unable to parse options\\n';
exit(1);
}