本文整理汇总了PHP中io::has方法的典型用法代码示例。如果您正苦于以下问题:PHP io::has方法的具体用法?PHP io::has怎么用?PHP io::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io
的用法示例。
在下文中一共展示了io::has方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extensions
public function extensions()
{
/*
* Ornithopter.io is very simple to use. Some sample controllers and
* sample models (like this one) have been setup to help you understand
* the basics of using the MVC framework and structuring projects.
*
* Access the framework by calling... io::method();
*/
// My first name
$first = 'Corey';
// My last name
$last = 'Olson';
// My birthday is...
$dob = 'November 14, 1987';
// My birthday was a long time ago...
$birthday = io::helper('time')->context(strtotime($dob));
/*
* You can check if a $_GET variable exists by using either
* route::has('var') or the short syntax io::has('var')
*/
// Hash a password or skip
if (io::has('do_bcrypt')) {
// A long time ago I used the password...
$password = io::helper('security')->hash('yippie');
} else {
// Slows down the script runtime severely
$password = 'Skipped secure password hashing (CPU intensive)';
}
// My home town is Chicago...
date_default_timezone_set('America/Chicago');
// The current time here is...
$now = time();
// Ornithopter.io has built in session management...
io::library('session');
// Load the session library on dynamic pages for users
$session_id = io::library('session')->id();
// Did you notice that?
io::library('session')->set('favorite_food', 'pizza');
// Chaining is allowed on most libraries and helpers (convenience)
$session = io::library('session');
// Making a reference; now I can type even less...
$session->set('favorite_drink', 'coffee');
// You can call libraries, helpers, models and controllers by shortnames
$time = io::h('time');
// Again I can now use the time helper class by referencing $time
$christmas = $time->prefix('future')->postfix('future')->context(strtotime('December 25 ' . date('Y')));
// Actually you can call libraries and helpers like this too... (Works for any library or helper)
$alt = io::html()->tag('blockquote', 'Alternative call to (any helper or library) via <strong>io::html()->tag();</strong>');
// Now we can show some information with a view
$page = io::view('example', array('name' => $first . ' ' . $last, 'bday' => $dob, 'bday_ago' => $birthday, 'pwd' => $password, 'currently' => $now, 'sessid' => $session_id, 'xmas_is' => $christmas, 'alt' => $alt));
/*
* Noticed how we passed variables to the view? The array we passed to
* the view will create the $key => $variables within the view for an
* easy and effective templating system. Just echo the view to see!
*/
echo $page;
}