本文整理汇总了PHP中Data::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Data::getInstance方法的具体用法?PHP Data::getInstance怎么用?PHP Data::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data::getInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_middleware
global $app, $user;
function admin_middleware()
{
global $app, $user;
if (!session('connected')) {
$app->redirect('/admin/_connect.html');
die;
}
return true;
}
// admin_middleware
$app->get('/admin/', 'admin_middleware', function () use($app) {
$app->redirect('/admin/' . Data::get('home'));
});
$app->post('/admin/', function () use($app) {
$data = Data::getInstance();
if (post('connect')) {
$iErrorLoop = intval(post('error')) + 1;
usleep(200000 * $iErrorLoop);
$oUser = $data->getUser(post('login'));
if (post('login') == 'leny' && sha1(post('password')) == '817f0e8f4b3551234a4f6366b45280c6218ef9aa') {
session('connected', true);
session('root', true);
$app->redirect('/admin/' . post('referer') ?: Data::get("home"));
return;
}
if (Data::get('branding_id') == 'minibos' && post('login') == 'idco' && sha1(post('password')) == '56336e8b6f91fa3c6e03db02c2022ca86f1e1b7c') {
session('connected', true);
session('root', true);
$app->redirect('/admin/' . post('referer') ?: Data::get("home"));
return;
示例2: select
/**
* Run selecting data. Returning specified data if $fields are specified
* @param array $fields fields you want to retrive
* @return \Database|\Data depending on multi/single select
*/
public function select($fields = null)
{
if (is_array($fields)) {
$xml = $this->xml;
foreach ($xml->row as $row) {
foreach ($row->field as $field) {
if (!in_array($field->attributes()->name, $fields)) {
$target = $row->xpath('//field[@name="' . $field->attributes()->name . '"]');
foreach ($target as $node) {
$domRef = dom_import_simplexml($node);
$domRef->parentNode->removeChild($domRef);
}
}
}
}
}
try {
$this->_xml_to_object();
} catch (Exception $msg) {
throw $msg;
}
return isset($this->_row_id) ? Data::getInstance() : $this;
}
示例3: __construct
public function __construct()
{
$oData = Data::getInstance();
$this->db = $oData->db;
}
示例4: _getHelper
/**
* @return Data
*/
protected function _getHelper()
{
return Data::getInstance();
}