哪种结构更好PHP HTTP库
哪种结构有用/更好?哪种结构更好PHP HTTP库,php,http,structure,Php,Http,Structure,哪种结构有用/更好? (PHP) 结构A + httpLib/ | . Index.php / Factory | . API.php | . _Exception.php | + Response/ | | . Interface.php | | . ... | + Request/ | | . Interface.php | | . ... 结构B + httpLib/ | . Response.php | . Request.p
(PHP)
结构A
+ httpLib/
| . Index.php / Factory
| . API.php
| . _Exception.php
| + Response/
| | . Interface.php
| | . ...
| + Request/
| | . Interface.php
| | . ...
结构B
+ httpLib/
| . Response.php
| . Request.php
| . API.php
| . _Exception.php
| + Client/
| | . Interface.php
| | . Socket.php
| | . Stream.php
| | . cURL.php
...
(我没有找到更好的标题)谢谢。第一种结构是最好的 使用它,您可以更好地分离请求和响应
请求和响应的结构定义良好,不在单个类中对于请求(curl、socket、stream…)来说是可以的,但是什么样的响应呢?HTTP响应:1xx:信息性-收到请求,继续处理。2xx:成功-成功接收、理解和接受行动。3xx:重定向-必须采取进一步的操作才能完成请求。4xx:客户端错误-请求包含错误语法或无法实现。5xx:服务器错误-服务器未能完成明显有效的请求。