当前位置: 首页>>代码示例>>PHP>>正文


PHP Slim::post方法代码示例

本文整理汇总了PHP中Slim::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Slim::post方法的具体用法?PHP Slim::post怎么用?PHP Slim::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Slim的用法示例。


在下文中一共展示了Slim::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * REST actions
  *
  * This function contains the REST actions with the assignments to
  * the functions.
  */
 public function __construct()
 {
     // runs the CConfig
     $com = new CConfig(DBAttachment2::getPrefix() . ',course,link', dirname(__FILE__));
     // runs the DBAttachment2
     if ($com->used()) {
         return;
     }
     $this->_conf = $com;
     // initialize slim
     $this->_app = new \Slim\Slim(array('debug' => true));
     $this->_app->response->headers->set('Content-Type', 'application/json');
     // POST AddCourse
     $this->_app->post('(/:pre)/course(/)', array($this, 'addCourse'));
     // POST DeleteCourse
     $this->_app->delete('(/:pre)/course/:courseid(/)', array($this, 'deleteCourse'));
     // PUT EditAttachment
     $this->_app->put('(/:pre)/' . $this->getPrefix() . '(/attachment)/:aid(/)', array($this, 'editAttachment'));
     // DELETE DeleteAttachment
     $this->_app->delete('(/:pre)/' . $this->getPrefix() . '(/attachment)/:aid(/)', array($this, 'deleteAttachment'));
     // POST AddAttachment
     $this->_app->post('(/:pre)/' . $this->getPrefix(), array($this, 'addAttachment'));
     // GET GetExistsCourseAttachments
     $this->_app->get('(/:pre)/link/exists/course/:courseid(/)', array($this, 'getExistsCourseAttachments'));
     // GET GetAttachment
     $this->_app->get('(/:pre)/' . $this->getPrefix() . '(/attachment)/:aid(/)', array($this, 'getAttachment'));
     // GET GetExerciseAttachments
     $this->_app->get('(/:pre)/' . $this->getPrefix() . '/exercise/:eid(/)', array($this, 'getExerciseAttachments'));
     // GET GetSheetAttachments
     $this->_app->get('(/:pre)/' . $this->getPrefix() . '/exercisesheet/:esid(/)', array($this, 'getSheetAttachments'));
     // GET GetCourseAttachments
     $this->_app->get('(/:pre)/' . $this->getPrefix() . '/course/:courseid(/)', array($this, 'getCourseAttachments'));
     // run Slim
     $this->_app->run();
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:41,代码来源:DBAttachment2.php

示例2: __construct

 /**
  * REST actions
  *
  * This function contains the REST actions with the assignments to
  * the functions.
  */
 public function __construct()
 {
     // runs the CConfig
     $com = new CConfig(LExtension::getPrefix() . ',course', dirname(__FILE__));
     // runs the LExtension
     if ($com->used()) {
         return;
     }
     $conf = $com->loadConfig();
     // initialize slim
     $this->app = new \Slim\Slim(array('debug' => true));
     $this->app->response->headers->set('Content-Type', 'application/json');
     // initialize component
     $this->_conf = $conf;
     $this->_extension = CConfig::getLinks($conf->getLinks(), "extension");
     //POST AddCourseExtension
     $this->app->post('/link/course/:courseid/extension/:name', array($this, 'addCourseExtension'));
     //DELETE DeleteCourseExtension
     $this->app->delete('/link/course/:courseid/extension/:name', array($this, 'deleteCourseExtension'));
     //DELETE DeleteCourse
     $this->app->delete('/course/:courseid/', array($this, 'deleteCourse'));
     //GET GetExtensionInstalled
     $this->app->get('/link/exists/course/:courseid/extension/:name', array($this, 'getExtensionInstalled'));
     //GET GetInstalledExtensions
     $this->app->get('/link/course/:courseid/extension', array($this, 'getInstalledExtensions'));
     //GET GetExtensions
     $this->app->get('/link/extension(/)', array($this, 'getExtensions'));
     //GET GetExtensionExists
     $this->app->get('/link/exists/extension/:name', array($this, 'getExtensionExists'));
     //GET GetExtension
     $this->app->get('/link/extension/:name', array($this, 'getExtension'));
     //run Slim
     $this->app->run();
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:40,代码来源:LExtension.php

示例3: __construct

 /**
  * REST actions
  *
  * This function contains the REST actions with the assignments to
  * the functions.
  */
 public function __construct()
 {
     // runs the CConfig
     $com = new CConfig(DBSetting::getPrefix() . ',course,link', dirname(__FILE__));
     // runs the DBSetting
     if ($com->used()) {
         return;
     }
     $this->_conf = $com;
     // initialize slim
     $this->_app = new \Slim\Slim(array('debug' => true));
     $this->_app->response->headers->set('Content-Type', 'application/json');
     // POST AddCourse
     $this->_app->post('(/:pre)/course', array($this, 'addCourse'));
     // POST DeleteCourse
     $this->_app->delete('(/:pre)/course/:courseid', array($this, 'deleteCourse'));
     // PUT EditSetting
     $this->_app->put('(/:pre)/' . $this->getPrefix() . '/setting/:setid', array($this, 'editSetting'));
     // DELETE DeleteSetting
     $this->_app->delete('(/:pre)/' . $this->getPrefix() . '/setting/:setid', array($this, 'deleteSetting'));
     // POST AddSetting
     $this->_app->post('(/:pre)/' . $this->getPrefix() . '/course/:courseid', array($this, 'addSetting'));
     // GET GetExistsCourseSettings
     $this->_app->get('(/:pre)/link/exists/course/:courseid', array($this, 'getExistsCourseSettings'));
     // GET GetCourseSettings
     $this->_app->get('(/:pre)/' . $this->getPrefix() . '/course/:courseid', array($this, 'getCourseSettings'));
     // GET GetSetting
     $this->_app->get('(/:pre)/' . $this->getPrefix() . '/setting/:setid', array($this, 'getSetting'));
     // GET GetSettingByName
     $this->_app->get('(/:pre)/' . $this->getPrefix() . '/course/:courseid/name/:setname', array($this, 'getSettingByName'));
     // run Slim
     $this->_app->run();
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:39,代码来源:DBSetting.php

示例4: __construct

 /**
  * REST actions
  *
  * This function contains the REST actions with the assignments to
  * the functions.
  *
  * @param Component $conf component data
  */
 public function __construct()
 {
     // runs the CConfig
     $com = new CConfig(LCourse::getPrefix(), dirname(__FILE__));
     // runs the LCourse
     if ($com->used()) {
         return;
     }
     $conf = $com->loadConfig();
     // initialize slim
     $this->app = new \Slim\Slim(array('debug' => true));
     $this->app->response->headers->set('Content-Type', 'application/json');
     // initialize component
     $this->_conf = $conf;
     $this->query = CConfig::getLink($conf->getLinks(), "controller");
     $this->_deleteCourse = CConfig::getLinks($conf->getLinks(), "deleteCourse");
     $this->_postCourse = CConfig::getLinks($conf->getLinks(), "postCourse");
     // initialize lURL
     $this->lURL = $this->query->getAddress();
     //POST AddCourse
     $this->app->post('/' . $this->getPrefix() . '(/)', array($this, 'AddCourse'));
     //PUT EditCourse
     $this->app->put('/' . $this->getPrefix() . '/course/:courseid(/)', array($this, 'editCourse'));
     //DELETE DeleteCourse
     $this->app->delete('/' . $this->getPrefix() . '/course/:courseid(/)', array($this, 'deleteCourse'));
     //POST AddCourseMember
     $this->app->post('/' . $this->getPrefix() . '/course/:courseid/user/:userid/status/:status(/)', array($this, 'addCourseMember'));
     //GET GetCourseMember
     $this->app->get('/' . $this->getPrefix() . '/course/:courseid/user(/)', array($this, 'getCourseMember'));
     //GET GetCourses
     $this->app->get('/' . $this->getPrefix() . '/user/:userid(/)', array($this, 'getCourses'));
     //run Slim
     $this->app->run();
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:42,代码来源:LCourse.php

示例5: __construct

 /**
  * REST actions
  *
  * This function contains the REST actions with the assignments to
  * the functions.
  */
 public function __construct()
 {
     // runs the CConfig
     $com = new CConfig(LProcessor::getPrefix() . ',submission,course,link', dirname(__FILE__));
     // runs the LProcessor
     if ($com->used()) {
         return;
     }
     $conf = $com->loadConfig();
     // initialize slim
     $this->app = new \Slim\Slim();
     $this->app->response->headers->set('Content-Type', 'application/json');
     // initialize component
     $this->_conf = $conf;
     $this->_submission = CConfig::getLinks($conf->getLinks(), "submission");
     $this->_marking = CConfig::getLinks($conf->getLinks(), "marking");
     $this->_processorDb = CConfig::getLinks($conf->getLinks(), "processorDb");
     $this->_attachment = CConfig::getLinks($conf->getLinks(), "attachment");
     $this->_workFiles = CConfig::getLinks($conf->getLinks(), "workFiles");
     $this->_file = CConfig::getLinks($conf->getLinks(), "file");
     $this->_createCourse = CConfig::getLinks($conf->getLinks(), "postCourse");
     $this->_getExerciseExerciseFileType = CConfig::getLinks($conf->getLinks(), "getExerciseExerciseFileType");
     // POST PostSubmission
     $this->app->map('/submission(/)', array($this, 'postSubmission'))->via('POST');
     // POST AddProcess
     $this->app->map('/' . $this->getPrefix() . '(/)', array($this, 'addProcess'))->via('POST');
     // POST AddCourse
     $this->app->post('/course(/)', array($this, 'addCourse'));
     // POST DeleteCourse
     $this->app->delete('/course/:courseid(/)', array($this, 'deleteCourse'));
     // GET GetExistsCourse
     $this->app->get('/link/exists/course/:courseid(/)', array($this, 'getExistsCourse'));
     // run Slim
     $this->app->run();
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:41,代码来源:LProcessor.php

示例6: __construct

 /**
  * REST actions
  *
  * This function contains the REST actions with the assignments to
  * the functions.
  */
 public function __construct()
 {
     // runs the CConfig
     $com = new CConfig(LFormProcessor::getPrefix() . ',course,link', dirname(__FILE__));
     // runs the LFormProcessor
     if ($com->used()) {
         return;
     }
     $conf = $com->loadConfig();
     // initialize slim
     $this->app = new \Slim\Slim(array('debug' => true));
     $this->app->response->headers->set('Content-Type', 'application/json');
     // initialize component
     $this->_conf = $conf;
     $this->_formDb = CConfig::getLinks($conf->getLinks(), "formDb");
     $this->_pdf = CConfig::getLinks($conf->getLinks(), "pdf");
     $this->_postProcess = CConfig::getLinks($conf->getLinks(), "postProcess");
     $this->_deleteProcess = CConfig::getLinks($conf->getLinks(), "deleteProcess");
     $this->_getProcess = CConfig::getLinks($conf->getLinks(), "getProcess");
     // POST PostProcess
     $this->app->map('/' . $this->getPrefix() . '(/)', array($this, 'postProcess'))->via('POST');
     // POST AddCourse
     $this->app->post('/course(/)', array($this, 'addCourse'));
     // POST DeleteCourse
     $this->app->delete('/course/:courseid(/)', array($this, 'deleteCourse'));
     // GET GetExistsCourse
     $this->app->get('/link/exists/course/:courseid(/)', array($this, 'getExistsCourse'));
     // run Slim
     $this->app->run();
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:36,代码来源:LFormProcessor.php

示例7: __construct

 /**
  * REST actions
  *
  * This function contains the REST actions with the assignments to
  * the functions.
  *
  * @param Component $conf component data
  */
 public function __construct()
 {
     // runs the CConfig
     $com = new CConfig(DBAttachment::getPrefix(), dirname(__FILE__));
     // runs the DBAttachment
     if ($com->used()) {
         return;
     }
     $conf = $com->loadConfig();
     // initialize component
     $this->_conf = $conf;
     $this->query = array(CConfig::getLink($conf->getLinks(), 'out'));
     $this->query2 = array(CConfig::getLink($conf->getLinks(), 'out2'));
     // initialize slim
     $this->_app = new \Slim\Slim();
     $this->_app->response->setStatus(409);
     $this->_app->response->headers->set('Content-Type', 'application/json');
     // POST AddPlatform
     $this->_app->post('/platform', array($this, 'addPlatform'));
     // DELETE DeletePlatform
     $this->_app->delete('/platform', array($this, 'deletePlatform'));
     // GET GetExistsPlatform
     $this->_app->get('/link/exists/platform', array($this, 'getExistsPlatform'));
     // PUT EditAttachment
     $this->_app->put('/' . $this->getPrefix() . '(/attachment)/:aid(/)', array($this, 'editAttachment'));
     // DELETE DeleteAttachment
     $this->_app->delete('/' . $this->getPrefix() . '(/attachment)/:aid(/)', array($this, 'deleteAttachment'));
     // DELETE DeleteExerciseAttachments
     $this->_app->delete('/' . $this->getPrefix() . '/exercise/:eid(/)', array($this, 'deleteExerciseAttachment'));
     // DELETE DeleteExerciseFileAttachment
     $this->_app->delete('/' . $this->getPrefix() . '/exercise/:eid/file/:fileid(/)', array($this, 'deleteExerciseFileAttachment'));
     // POST AddAttachment
     $this->_app->post('/' . $this->getPrefix() . '(/)', array($this, 'addAttachment'));
     // GET GetAttachment
     $this->_app->get('/' . $this->getPrefix() . '(/attachment)/:aid(/)', array($this, 'getAttachment'));
     // GET GetAllAttachments
     $this->_app->get('/' . $this->getPrefix() . '(/attachment)(/)', array($this, 'getAllAttachments'));
     // GET GetExerciseAttachments
     $this->_app->get('/' . $this->getPrefix() . '/exercise/:eid(/)', array($this, 'getExerciseAttachments'));
     // GET GetSheetAttachments
     $this->_app->get('/' . $this->getPrefix() . '/exercisesheet/:esid(/)', array($this, 'getSheetAttachments'));
     // run Slim
     $this->_app->run();
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:52,代码来源:DBAttachment.php

示例8: __construct

 /**
  * the component constructor
  */
 public function __construct()
 {
     // runs the CConfig
     $com = new CConfig(CControl::getPrefix() . ',link,definition', dirname(__FILE__));
     // runs the DBSubmission
     if ($com->used()) {
         return;
     }
     // initialize slim
     $this->_app = new \Slim\Slim();
     $this->_app->response->headers->set('Content-Type', 'application/json');
     // POST AddPlatform
     $this->_app->post('/platform', array($this, 'addPlatform'));
     // DELETE DeletePlatform
     $this->_app->delete('/platform', array($this, 'deletePlatform'));
     // GET GetExistsPlatform
     $this->_app->get('/link/exists/platform', array($this, 'getExistsPlatform'));
     // GET GetTableReferences
     $this->_app->get('/tableReferences', array($this, 'getTableReferences'));
     // PUT EditLink
     $this->_app->put('/link/:linkid(/)', array($this, 'editLink'));
     // DELETE DeleteLink
     $this->_app->delete('/link/:linkid(/)', array($this, 'deleteLink'));
     // POST SetLink
     $this->_app->post('/link(/)', array($this, 'setLink'));
     // GET GetLink
     $this->_app->get('/link/:linkid(/)', array($this, 'getLink'));
     // PUT EditComponent
     $this->_app->put('/component/:componentid(/)', array($this, 'editComponent'));
     // DELETE DeleteComponent
     $this->_app->delete('/component/:componentid(/)', array($this, 'deleteComponent'));
     // POST SetComponent
     $this->_app->post('/component(/)', array($this, 'setComponent'));
     // GET GetComponent
     $this->_app->get('/component/:componentid(/)', array($this, 'getComponent'));
     // GET GetComponentDefinitions
     $this->_app->get('/definition(/)', array($this, 'getComponentDefinitions'));
     // GET SendComponentDefinitions
     $this->_app->get('(/definition)/send(/)', array($this, 'sendComponentDefinitions'));
     // GET GetComponentDefinition
     $this->_app->get('/definition/:componentid(/)', array($this, 'getComponentDefinition'));
     // run Slim
     $this->_app->run();
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:47,代码来源:CControl.php

示例9: __construct

 /**
  * REST actions
  *
  * This function contains the REST actions with the assignments to
  * the functions.
  */
 public function __construct()
 {
     // runs the CConfig
     $com = new CConfig('transaction,course,link', dirname(__FILE__));
     // runs the DBTransaction
     if ($com->used()) {
         return;
     }
     $this->_conf = $com;
     // initialize slim
     $this->_app = new \Slim\Slim(array('debug' => true));
     $this->_app->response->headers->set('Content-Type', 'application/json');
     // POST AddCourse
     $this->_app->post('(/:name)/course', array($this, 'addCourse'));
     // POST DeleteCourse
     $this->_app->delete('(/:name)/course/:courseid', array($this, 'deleteCourse'));
     // GET GetExistsCourseTransactions
     $this->_app->get('(/:name)/link/exists/course/:courseid', array($this, 'getExistsCourseTransactions'));
     // DELETE DeleteTransaction
     $this->_app->delete('(/:name)/transaction/authentication/:auid/transaction/:tid', array($this, 'deleteTransaction'));
     // DELETE DeleteTransactionShort
     $this->_app->delete('(/:name)/transaction/transaction/:tid', array($this, 'deleteTransactionShort'));
     // POST AddTransaction
     $this->_app->post('(/:name)/transaction/course/:courseid', array($this, 'addTransaction'));
     // POST AddSheetTransaction
     $this->_app->post('(/:name)/transaction/exercisesheet/:esid', array($this, 'addSheetTransaction'));
     // POST AddExerciseTransaction
     $this->_app->post('(/:name)/transaction/exercise/:eid', array($this, 'addExerciseTransaction'));
     // GET GetTransaction
     $this->_app->get('(/:name)/transaction/authentication/:auid/transaction/:tid', array($this, 'getTransaction'));
     // GET GetTransactionShort
     $this->_app->get('(/:name)/transaction/transaction/:tid', array($this, 'getTransactionShort'));
     // GET GetAmountOfExpiredTransactions
     $this->_app->get('(/:name)/clean/clean/course/:courseid', array($this, 'getAmountOfExpiredTransactions'));
     // DELETE CleanTransactions
     $this->_app->delete('(/:name)/clean/clean/course/:courseid', array($this, 'cleanTransactions'));
     // run Slim
     $this->_app->run();
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:45,代码来源:DBTransaction.php

示例10: __construct

 /**
  * REST actions
  *
  * This function contains the REST actions with the assignments to
  * the functions.
  */
 public function __construct()
 {
     // runs the CConfig
     $com = new CConfig(DBChoice::getPrefix() . ',course,link', dirname(__FILE__));
     // runs the DBChoice
     if ($com->used()) {
         return;
     }
     // initialize component
     $this->_conf = $com;
     // initialize slim
     $this->_app = new \Slim\Slim(array('debug' => true));
     $this->_app->response->headers->set('Content-Type', 'application/json');
     // POST AddCourse
     $this->_app->post('(/:preChoice(/:preForm(/:preExercise)))/course', array($this, 'addCourse'));
     // DELETE DeleteCourse
     $this->_app->delete('(/:preChoice(/:preForm(/:preExercise)))/course(/course)/:courseid', array($this, 'deleteCourse'));
     // PUT EditChoice
     $this->_app->put('(/:preChoice(/:preForm(/:preExercise)))/' . $this->getPrefix() . '(/choice)/:choiceid(/)', array($this, 'editChoice'));
     // DELETE DeleteChoice
     $this->_app->delete('(/:preChoice(/:preForm(/:preExercise)))/' . $this->getPrefix() . '(/choice)/:choiceid(/)', array($this, 'deleteChoice'));
     // POST AddChoice
     $this->_app->post('(/:preChoice(/:preForm(/:preExercise)))/' . $this->getPrefix() . '(/)', array($this, 'addChoice'));
     // GET GetChoice
     $this->_app->get('(/:preChoice(/:preForm(/:preExercise)))/' . $this->getPrefix() . '(/choice)/:choiceid(/)', array($this, 'getChoice'));
     // GET GetCourseChoices
     $this->_app->get('(/:preChoice(/:preForm(/:preExercise)))/' . $this->getPrefix() . '/course/:courseid(/)', array($this, 'getCourseChoices'));
     // GET GetExistsCourseChoices
     $this->_app->get('(/:preChoice(/:preForm(/:preExercise)))/link/exists/course/:courseid(/)', array($this, 'getExistsCourseChoices'));
     // GET GetSheetChoices
     $this->_app->get('(/:preChoice(/:preForm(/:preExercise)))/' . $this->getPrefix() . '/exercisesheet/:esid(/)', array($this, 'getSheetChoices'));
     // GET GetExerciseChoices
     $this->_app->get('(/:preChoice(/:preForm(/:preExercise)))/' . $this->getPrefix() . '/exercise/:eid(/)', array($this, 'getExerciseChoices'));
     // GET GetFormChoices
     $this->_app->get('(/:preChoice(/:preForm(/:preExercise)))/' . $this->getPrefix() . '/form/:formid(/)', array($this, 'getFormChoices'));
     // run Slim
     $this->_app->run();
 }
开发者ID:ostepu,项目名称:ostepu-forms,代码行数:44,代码来源:DBChoice.php

示例11: __construct

 /**
  * REST actions
  *
  * This function contains the REST actions with the assignments to
  * the functions.
  */
 public function __construct()
 {
     // runs the CConfig
     $com = new CConfig(DBForm::getPrefix() . ',course,link', dirname(__FILE__));
     // runs the DBForm
     if ($com->used()) {
         return;
     }
     $conf = $com->loadConfig();
     // initialize component
     $this->_conf = $conf;
     $this->query = array(CConfig::getLink($conf->getLinks(), 'out'));
     // initialize slim
     $this->_app = new \Slim\Slim();
     $this->_app->response->headers->set('Content-Type', 'application/json');
     // POST AddCourse
     $this->_app->post('/course(/)', array($this, 'addCourse'));
     // POST DeleteCourse
     $this->_app->delete('/course/:courseid(/)', array($this, 'deleteCourse'));
     // PUT EditForm
     $this->_app->put('/' . $this->getPrefix() . '(/form)/:formid(/)', array($this, 'editForm'));
     // DELETE DeleteForm
     $this->_app->delete('/' . $this->getPrefix() . '(/form)/:formid(/)', array($this, 'deleteForm'));
     // POST AddForm
     $this->_app->post('/' . $this->getPrefix() . '(/)', array($this, 'addForm'));
     // GET GetForm
     $this->_app->get('/' . $this->getPrefix() . '(/form)/:formid(/)', array($this, 'getForm'));
     // GET GetCourseForms
     $this->_app->get('/' . $this->getPrefix() . '/course/:courseid(/)', array($this, 'getCourseForms'));
     // GET GetExistsCourseForms
     $this->_app->get('/link/exists/course/:courseid(/)', array($this, 'getExistsCourseForms'));
     // GET GetSheetForms
     $this->_app->get('/' . $this->getPrefix() . '/exercisesheet/:esid(/)', array($this, 'getSheetForms'));
     // GET GetExerciseForms
     $this->_app->get('/' . $this->getPrefix() . '/exercise/:eid(/)', array($this, 'getExerciseForms'));
     // run Slim
     $this->_app->run();
 }
开发者ID:ostepu,项目名称:ostepu-forms,代码行数:44,代码来源:DBForm.php

示例12: __construct

 /**
  * REST actions
  *
  * This function contains the REST actions with the assignments to
  * the functions.
  */
 public function __construct()
 {
     // runs the CConfig
     $com = new CConfig(LOOP::getPrefix() . ',course,link', dirname(__FILE__));
     // runs the LOOP
     if ($com->used()) {
         return;
     }
     $conf = $com->loadConfig();
     // lädt die Daten der CConfig.json
     // initialize slim
     $this->app = new \Slim\Slim(array('debug' => true));
     $this->app->response->headers->set('Content-Type', 'application/json');
     // initialize component
     // hier werden die Verknüpfungen aus der CConfig.json ausgelesen (entsprechend ihrem Namen)
     $this->_conf = $conf;
     $this->_pdf = CConfig::getLinks($conf->getLinks(), "pdf");
     // wird nicht genutzt, theoretisch koennten hier PDFs erzeugt werden
     // für POST /course zum eintragen als Verarbeitung (wird dann in CreateSheet aufgelistet)
     $this->_postProcess = CConfig::getLinks($conf->getLinks(), "postProcess");
     $this->_deleteProcess = CConfig::getLinks($conf->getLinks(), "deleteProcess");
     // für DELETE /course/xyz
     $this->_getProcess = CConfig::getLinks($conf->getLinks(), "getProcess");
     // GET /link/exists/course/:courseid
     // POST PostProcess
     $this->app->map('/' . $this->getPrefix() . '(/)', array($this, 'postProcess'))->via('POST');
     // POST AddCourse
     // fügt die Komponente der Veranstaltung hinzu (Daten kommen im Anfragekörper)
     $this->app->post('/course(/)', array($this, 'addCourse'));
     // DELETE DeleteCourse
     // entfernt die Komponente aus der Veranstaltung
     $this->app->delete('/course/:courseid(/)', array($this, 'deleteCourse'));
     // GET GetExistsCourse
     // zum Prüfen, ob diese Kompoenten korrekt installiert wurde (existiert Tabelleneintrag, konf-Dateien etc.)
     $this->app->get('/link/exists/course/:courseid(/)', array($this, 'getExistsCourse'));
     // run Slim
     $this->app->run();
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:44,代码来源:LOOP.php

示例13: dirname

<?php

require dirname(__FILE__) . '/../Slim/Slim.php';
$app = new Slim();
$app->get("/", "getStores");
$app->get("/:id", "getStore");
$app->get("/search/:query", "findByName");
$app->post("/", "addStore");
$app->put("/:id", "updateStore");
$app->delete("/:id", "deleteStore");
$app->run();
function getStores()
{
    $sql = "select * FROM store ORDER BY name";
    try {
        $db = getConnection();
        $stmt = $db->query($sql);
        $stores = $stmt->fetchAll(PDO::FETCH_OBJ);
        $db = null;
        // echo '{"wine": ' . json_encode($wines) . '}';
        echo json_encode($stores);
    } catch (PDOException $e) {
        echo '{"error":{"text":' . $e->getMessage() . '}}';
    }
}
function getStore($id)
{
    $sql = "SELECT * FROM store WHERE id=:id";
    try {
        $db = getConnection();
        $stmt = $db->prepare($sql);
开发者ID:nidhhoggr,项目名称:backbone.js-wine,代码行数:31,代码来源:index.php

示例14: testSlimPostRoute

 /**
  * Test Slim sets POST route
  *
  * Pre-conditions:
  * You have initialized a Slim app with a POST route.
  *
  * Post-conditions:
  * The POST route is returned, and its pattern and
  * callable are set correctly.
  */
 public function testSlimPostRoute(){
     Slim::init();
     $callable = function () { echo "foo"; };
     $route = Slim::post('/foo/bar', $callable);
     $this->assertEquals('/foo/bar', $route->getPattern());
     $this->assertSame($callable, $route->getCallable());
 }
开发者ID:ntdt,项目名称:Slim,代码行数:17,代码来源:SlimTest.php

示例15: function

    $title = 'My KraigsList Search';
    $init = false;
    require 'templates/index.php';
});
$app->post('/', function () use($app, $sites) {
    $loadConfiguration = "findjobs.locations.xml";
    $site = isset($_POST['site']) ? $_POST['site'] : false;
    if (isset($sites[$site])) {
        $loadConfiguration = "{$site}.locations.xml";
    } else {
        echo json_encode(array());
        return;
    }
    try {
        require 'lib/CraigListScraper.class.php';
        $cl_scraper = new CraigListScraper("sites/{$loadConfiguration}");
        $search_field = $cl_scraper->getFields();
        $search_field_name = $search_field[0]['argName'];
        if (isset($_POST[$search_field_name]) && strlen($_POST[$search_field_name])) {
            header('Content-type: application/json');
            $cl_scraper->initialize($_POST['include']);
            echo $cl_scraper;
            exit;
        }
    } catch (Exception $e) {
        echo $e->getMessage();
    }
});
$app->get('/site/:site', function ($site) use($app, $sites) {
    $init = true;
    $loadConfiguration = "findjobs.locations.xml";
    if (isset($sites[$site])) {
开发者ID:robertkraig,项目名称:Craigslist-Aggregator,代码行数:32,代码来源:index.php


注:本文中的Slim::post方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。