LoginSignup
1
0

More than 1 year has passed since last update.

phpとLaravelいじっているときに、しょうもない理由で詰まった話。

Last updated at Posted at 2021-07-10

OpenWeatherMapが出しているAPIを使おうとしていて、そのときに、

syntax error, unexpected '='

になってしまいました。
該当のコードはこんなかんじでした。

api_url = 'https://api.openweathermap.org/data/2.5/forecastlat=&lon=&appid=[API_KEY]'

はい、勘のいい人だったら気づくと思います。
そう、変数をPHPで定義するなら、最初に$が必要ですよね。
然しそれがないので、ただの文字列にこのURLを入れようとしているわけです。
こんなことできるわけありません。

初心者の皆さん、気をつけましょう。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0