set_content
设置响应内容
如果指定了content_type,data必须为buffer或string;否则,将根据data的类型推断content_type:
-
若data是buffer,则content_type被推断为"application/octet-stream"
-
若data是string,则content_type被推断为"text/plain"
-
否则,将data进行json编码,content_type被推断为"application/json"
声明
void set_content(Response self, mixed data, string content_type = nil)