1
I tried to create a class, and getting the error below I already researched more not found why is giving this error.
Error:
Fatal error: Uncaught Error: Call to undefined function run_search() in D:\xampp\htdocs\Github\astra\class\buscaAnimes.class.php:17 Stack trace: #0 D:\xampp\htdocs\Github\astra\index.php(11): buscaAnimes->get_busca('21') #1 {main} thrown in D:\xampp\htdocs\Github\astra\class\buscaAnimes.class.php on line 17
Class::
<?php
class buscaAnimes{
private $idAnime;
private $urlMal;
public function __construct(){
}
//Pega a id passada pelo usuario e atribui ao $idAnime
public function get_busca($b){
$this->idAnime = $b;
$resposta = run_search();
return $resposta;
}
private function run_search(){
if(!isset($this->idAnime) & empty($this->idAnime)){
return 'Erro: É necessario um id para fazer a busca';
}
$this->urlMal = 'https://exemplo.com/anime/'. $this->idAnime .'/';
$resposta = curlSearch($this->urlMal,'get');
if($resposta[1] != 200){
return $resposta[1];
}else{
$resposta = $resposta[0];
return $resposta;
}
}
}
?>
I got it, I tested it and it worked. Brigado!
– Lukas Takahashi