SHARE
TWEET

Untitled

a guest Jun 3rd, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function obtemCursosApi($request, $response, $args)
  2.     {
  3.         $model = new CursoModel($this->container);
  4.         $dados = [];
  5.  
  6.         foreach ($model->getAll() as $key => $value) {
  7.             foreach ($value as $key2 => $value2) {
  8.                 $dados[$key][$key2] = $value2;
  9.  
  10.                 if (in_array($key2, ['descricao', 'resumo_destaque', 'infos_valores', 'infos_aulas'])) {
  11.                     $dados[$key][$key2] = htmlspecialchars($value2);
  12.                 }
  13.             }
  14.         }
  15.        
  16.         $handle = fopen("json.json", "a");
  17.        
  18.         $conteudo = json_encode(['sucesso' => true, 'dados' => $dados]);
  19.         fwrite($handle, $conteudo);
  20.        
  21.        
  22.         return $conteudo;
  23.        
  24.        
  25.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top