codeigniter - php Use of undefined constant zip - assumed 'zip' -
this question has answer here:
sorry i'm new php , i'm getting error when trying use argument function. doing wrong?
public function legislatorsbyzip($zip = null) { $url = "..."; $params = [ zip => $zip, ]; $data= $this->curl->simple_get($url, $params); return $data; }
error:
a php error encountered
severity: notice
message: use of undefined constant zip - assumed 'zip'
filename: models/congressapi.php
line number: 11
(zip=> $zip line 11 btw) please let me know if need more info..
use "zip" instead of zip , assoc. array should have keys strings or int , words without $
sign constants
$params = [zip => $zip];
change into
$params = ["zip" => $zip];
Comments
Post a Comment