Outils pour utilisateurs

Outils du site


web:php:cakephp20

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
web:php:cakephp20 [2014/10/19 02:24] – [Mise en place] sgariepyweb:php:cakephp20 [2022/02/02 00:42] (Version actuelle) – modification externe 127.0.0.1
Ligne 98: Ligne 98:
  
  
-==== Routes ====+===== Routes ====
 + 
 +==== POST /users/1234/votes ==== 
 + 
 +Dans ''route.php''
 +<code php> 
 +Router::connect('/api/users/:id/votes', 
 +  array( 
 +    'plugin' => null, 
 +    'controller' => 'users', 
 +    'action' => 'vote', 
 +    '[method]' => 'POST' 
 +  ), 
 +  array('id' => Router::ID, 'pass' => 'id'
 +); 
 +</code> 
 + 
 + 
 +===== API Key ===== 
 + 
 + 
 + 
 +===== Sources ===== 
 +  * http://fr.slideshare.net/ceeram/cake-fest-2012-create-a-restful-api-14181476 
 +  * https://github.com/kvz/cakephp-rest-plugin 
 +  * http://miftyisbored.com/complete-restful-service-client-cakephp-tutorial/ 
 +====== Debug code ====== 
 + 
 + 
 +<code php> 
 +/** 
 + * Prints out debug information about given variable. 
 + * 
 + * Only runs if debug level is greater than zero. 
 + * 
 + * @param boolean $var Variable to show debug information for. 
 + * @param boolean $showHtml If set to true, the method prints the debug data in a screen-friendly way. 
 + * @param boolean $showFrom If set to true, the method prints from where the function was called. 
 + * @link http://book.cakephp.org/view/458/Basic-Debugging 
 + */ 
 +function debug($var = false, $showHtml = false, $showFrom = true) { 
 +  if (Configure::read() > 0) { 
 +    if ($showFrom) { 
 +      $calledFrom = debug_backtrace(); 
 +      echo '<strong>' . substr(str_replace(ROOT, '', $calledFrom[0]['file']), 1) . '</strong>'; 
 +      echo ' (line <strong>' . $calledFrom[0]['line'] . '</strong>)'; 
 +    } 
 +    echo "\n<pre class=\"cake-debug\">\n"; 
 + 
 +    $var = print_r($var, true); 
 +    if ($showHtml) { 
 +      $var = str_replace('<', '&lt;', str_replace('>', '&gt;', $var)); 
 +    } 
 +    echo $var . "\n</pre>\n"; 
 +  } 
 +
 +</code> 
 + 
 +[[http://snipplr.com/view/52261/|Source]]
  
  
web/php/cakephp20.1413678272.txt.gz · Dernière modification : 2022/02/02 00:43 (modification externe)