當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Web::service方法代碼示例

本文整理匯總了PHP中Web::service方法的典型用法代碼示例。如果您正苦於以下問題:PHP Web::service方法的具體用法?PHP Web::service怎麽用?PHP Web::service使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Web的用法示例。


在下文中一共展示了Web::service方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: printview_GET

function printview_GET(Web &$w)
{
    $p = $w->pathMatch("table", "id");
    $attachments = $w->service("File")->getAttachments($p['table'], $p['$id']);
    $w->ctx("attachments", $attachments);
    $w->setLayout(null);
}
開發者ID:itillawarra,項目名稱:cmfive,代碼行數:7,代碼來源:printview.php

示例2: atfile_GET

function atfile_GET(Web &$w)
{
    $p = $w->pathMatch("id");
    $id = str_replace(".jpg", "", $p['id']);
    $attachment = $w->service("File")->getAttachment($id);
    $w->sendFile(FILE_ROOT . $attachment->fullpath);
}
開發者ID:itillawarra,項目名稱:cmfive,代碼行數:7,代碼來源:atfile.php

示例3: attach_POST

function attach_POST(Web &$w)
{
    $table = $w->request('table');
    $id = $w->request('id');
    $title = $w->request('title');
    $description = $w->request('description');
    $type_code = $w->request('type_code');
    $url = str_replace(" ", "/", $w->request('url'));
    $object = $w->Auth->getObject($table, $id);
    if (!$object) {
        $w->error("Nothing to attach to.", $url);
    }
    $aid = $w->service("File")->uploadAttachment("file", $object, $title, $description, $type_code);
    if ($aid) {
        $w->ctx('attach_id', $aid);
        $w->ctx('attach_table', $table);
        $w->ctx('attach_table_id', $id);
        $w->ctx('attach_title', $title);
        $w->ctx('attach_description', $description);
        $w->ctx('attach_type_code', $type_code);
        $w->msg("File attached.", $url);
    } else {
        $w->error("There was an error. Attachment could not be saved.", $url);
    }
}
開發者ID:itillawarra,項目名稱:cmfive,代碼行數:25,代碼來源:attach.php

示例4: atthumb_GET

function atthumb_GET(Web &$w)
{
    $p = $w->pathMatch("id", array("w", 150), array("h", 150));
    $id = str_replace(".jpg", "", $p['id']);
    $attachment = $w->service("File")->getAttachment($id);
    require_once 'phpthumb/ThumbLib.inc.php';
    $thumb = PhpThumbFactory::create(FILE_ROOT . $attachment->fullpath);
    $thumb->resize($p['w'], $p['h']);
    //$thumb->adaptiveResize($p['w'], $p['h']);
    $thumb->show();
    exit;
}
開發者ID:itillawarra,項目名稱:cmfive,代碼行數:12,代碼來源:atthumb.php

示例5: atdel_GET

function atdel_GET(Web &$w)
{
    $p = $w->pathMatch("id", "url");
    $att = $w->service("File")->getAttachment($p['id']);
    if ($att) {
        $w->ctx('attach_id', $att->id);
        $w->ctx('attach_table', $att->parent_table);
        $w->ctx('attach_table_id', $att->parent_id);
        $w->ctx('attach_title', $att->title);
        $w->ctx('attach_description', $att->description);
        $att->delete();
        $w->msg("Attachment deleted.", "/" . str_replace(" ", "/", $p['url']));
    } else {
        $w->error("Attachment does not exist.", "/" . str_replace(" ", "/", $p['url']));
    }
}
開發者ID:itillawarra,項目名稱:cmfive,代碼行數:16,代碼來源:atdel.php


注:本文中的Web::service方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。