Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

swarley_HIMYM's avatar

Laravel return JSON

hi gaes,

why my code like this

return response()->json(['some data...']);  

doesnt work in my hosting, but if try in localhost it work fine. in hosting content-type : text/html in localhost content-type: application/json

please, help me

0 likes
3 replies
jlrdw's avatar

@rully have you verified you are using the same code base in hosting, same use statements, etc.

1 like

Please or to participate in this conversation.