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


PHP Crud::addSubject方法代碼示例

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


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

示例1: testCrud

 public function testCrud()
 {
     $c = new Crud();
     $c->addSubject(array('data' => array(array('id' => '123', 'title' => 'shirt', 'images' => array('https://upload.wikimedia.org/wikipedia/commons/8/8c/Polo_Shirt_Basic_Pattern.png'), 'thumbnails' => array('https://upload.wikimedia.org/wikipedia/commons/8/8c/Polo_Shirt_Basic_Pattern.png')))));
     $r = $this->engine->upload($c);
     $this->assertEquals($r->status, 200);
     $r = $this->engine->update($c);
     $this->assertEquals($r->status, 200);
     $r = $this->engine->delete($c);
     $this->assertEquals($r->status, 200);
 }
開發者ID:pvwoods,項目名稱:merlin-php,代碼行數:11,代碼來源:CrudTest.php

示例2: MerlinCrud

<?php

namespace Merlin;

require_once '../Merlin/Merlin.php';
//creates an instance of the Merlin crud engine
$crud = new MerlinCrud('blackbird', 'dev', 'guest_dev', 'c73c11c411b449e6a16755efd219cf18', 'guest@blackbird.am');
// creates a Crud parameter and adds a subject
$c = new Crud();
$c->addSubject(array('data' => array(array('id' => '123', 'title' => 'shirt', 'images' => array('https://upload.wikimedia.org/wikipedia/commons/8/8c/Polo_Shirt_Basic_Pattern.png'), 'thumbnails' => array('https://upload.wikimedia.org/wikipedia/commons/8/8c/Polo_Shirt_Basic_Pattern.png')))));
//uploads the subject
$r = $crud->upload($c);
var_dump($r);
// create the same subject but change the title
$c = new Crud();
$c->addSubject(array('data' => array(array('id' => '123', 'title' => 'plain shirt'))));
// update the subject
$r = $crud->update($c);
var_dump($r);
//delete the subject
$r = $crud->delete($c);
var_dump($r);
開發者ID:blackbirdtech,項目名稱:merlin-php,代碼行數:22,代碼來源:crudExamples.php


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