Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function obtemCursosApi($request, $response, $args)
- {
- $model = new CursoModel($this->container);
- $dados = [];
- foreach ($model->getAll() as $key => $value) {
- foreach ($value as $key2 => $value2) {
- $dados[$key][$key2] = $value2;
- if (in_array($key2, ['descricao', 'resumo_destaque', 'infos_valores', 'infos_aulas'])) {
- $dados[$key][$key2] = htmlspecialchars($value2);
- }
- }
- }
- $handle = fopen("json.json", "a");
- $conteudo = json_encode(['sucesso' => true, 'dados' => $dados]);
- fwrite($handle, $conteudo);
- return $conteudo;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement