Why do we use the lamp environment, access to the PHP page need to return to Hello world, directly in the file to write Echo ' Hello World ', and Django needs
from django.http import HttpResponsedef index(request): return HttpResponse('Hello World')~
How about this?
Reply content:
Why do we use the lamp environment, access to the PHP page need to return to Hello world, directly in the file to write Echo ' Hello World ', and Django needs
from django.http import HttpResponsedef index(request): return HttpResponse('Hello World')~
How about this?
Just encapsulation of the HTTP protocol.
PHP also has a similar library, just because PHP is not a strict object-oriented language, of course, it also supports object-oriented programming.
The advantage of this writing is that it has all the benefits of object-oriented. More readable.
Response('hello!world')->withHeader(['Content-type:text/html;charset=utf8;']);//PHP也可以以这样的方式编程.//当然你也可以这样header('Content-type:text/html;charset=utf8;');echo 'hello!world';
So it's just a way of programming, without having to tangle.