本文整理汇总了PHP中Routes::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Routes::set方法的具体用法?PHP Routes::set怎么用?PHP Routes::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Routes
的用法示例。
在下文中一共展示了Routes::set方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fromId
<?php
// Set the needed routes
Routes::set('notifications/get', 'notifications#get');
Routes::set('notifications/clear', 'notifications#clear');
Routes::set('notifications/push', 'notifications#get_push_ticket');
/**
* Class for sending notifications to users.
*/
class Notification
{
/**
* 180 days
*/
const NOTIFICATION_EXPIRE = 15552000;
/**
* The maximum amount of notifications to show.
*/
const NOTIFICAITON_MAX = 30;
/**
* The local database row.
*/
private $row = null;
/**
* Gets a notification given its unique id.
* @param int $notificationid The notification id.
* @return \Notification
*/
public static function fromId($notificationid)
{
$query = Database::connection()->prepare('SELECT * FROM user_notification WHERE notificationid = ?');
示例2: fromId
<?php
Routes::set('entry/get', 'entry#get');
Routes::set('entry/create', 'entry#create');
Routes::set('entry/delete', 'entry#delete');
Routes::set('entry/edit', 'entry#edit');
Routes::set('entry/upload_attachment', 'entry#upload_attachment');
Routes::set('entry/delete_attachment', 'entry#delete_attachment');
Routes::set('entry/attachment/{entryid}/{attachmentid}', 'entry#get_attachment', false);
/**
* Represents a course entry.
*/
class Entry
{
/**
* The local database row.
*/
private $row;
/**
* Local attachment storage.
* @var Attachment[]
*/
private $attachments;
/**
* Gets a entry given its unique id.
* @param int $entryid The entry id.
* @return Entry
*/
public static function fromId($entryid)
{
// See if theres a cache hit
示例3:
<?php
Routes::set('user/create', 'user#create');
Routes::set('user/fetch', 'user#fetch');
Routes::set('user/login', 'user#login');
Routes::set('user/logout', 'user#logout');
Routes::set('user/changepassword', 'user#change_password');
Routes::set('user/verify/{userid}/{code}', 'user#verify', false);
Routes::set('user/verify/resend', 'user#verify_resend');
Routes::set('user/recover', 'user#recover');
Routes::set('user/settings/setavatar', 'user#set_avatar');
Routes::set('user/avatar/{userid}/{attachmentid}.png', 'user#get_avatar', false);
/**
* Class for handling and manipulating users.
*/
class User
{
/**
* The amount of time a temp password is valid for.
*/
const TEMP_PASSWORD_EXPIRE_TIME = 10800;
/**
* The currently loaded row for the user.
* @var array
*/
private $row = null;
/**
* Gets a user from their userid.
* @param string $id The user's id.
* @return User
*/
示例4:
<?php
Routes::set('question/get', 'question#get');
Routes::set('question/create', 'question#create');
Routes::set('question/delete', 'question#delete');
Routes::set('question/edit', 'question#edit');
Routes::set('question/toggle_closed', 'question#toggle_closed');
Routes::set('question/toggle_private', 'question#toggle_private');
Routes::set('answer/get', 'question#get_answer');
Routes::set('answer/create', 'question#create_answer');
Routes::set('answer/delete', 'question#delete_answer');
Routes::set('answer/edit', 'question#edit_answer');
Routes::set('answer/toggle_like', 'question#toggle_like');
/**
* Represnets a question that can be asked.
*/
class Question
{
/**
* The local database row.
*/
private $row;
/**
* The cache of answers.
* @var QuestionAnswer[]
*/
private $answerCache;
/**
* Gets a question given its unique id.
* @param int $questionid The question id.
* @return Question
示例5:
<?php
Routes::set('course/get_list', 'course#get_list');
Routes::set('course/get', 'course#get');
Routes::set('course/edit', 'course#edit');
Routes::set('course/add_students', 'course#add_students');
Routes::set('course/add_professor', 'course#add_professor');
Routes::set('course/remove_student', 'course#remove_student');
Routes::set('course/create', 'course#create');
/**
* Represents a school course.
*/
class Course
{
/**
* The local database row.
*/
private $row;
/**
* The array of users who are in this course.
* @var User[]
*/
private $users;
/**
* The array of users who are professors for this course.
* @var User[]
*/
private $professors;
/**
* Gets a course given its unique id.
* @param int $courseid The course id.