示例#1
0
<?php

/**
 * $Id$
 */
require_once '../../kanon-framework.php';
class storageExample extends controller
{
    public function onConstruct()
    {
        kanon::getStorage('icons')->setPath('.')->setUrl($this->rel());
        kanon::getStorage('images')->setPath('./images')->setUrl($this->rel('images'));
    }
    public function index()
    {
        $storage = kanon::getStorage('icons');
        echo 'Path: ' . $storage->getPath('favicon.ico') . '<br />';
        echo 'Url: ' . $storage->getUrl('favicon.ico') . '<br />';
        $storage = kanon::getStorage('images');
        echo 'Path: ' . $storage->getPath('test.jpg') . '<br />';
        echo 'Url: ' . $storage->getUrl('test.jpg') . '<br />';
    }
}
kanon::run('storageExample');
示例#2
0
<?php

/**
 * $Id$
 */
require_once '../../kanon-framework.php';
class helloWorld extends controller
{
    public function index()
    {
        echo 'Hello world!';
    }
    /** !Route GET $firstName/$lastName */
    public function hello($firstName, $lastName)
    {
        echo 'Hello ' . $firstName . ' ' . $lastName . '!';
    }
}
kanon::run('helloWorld');