ReflectionMethod

博客介绍了使用new ReflectionMethod($class, $method)来反射回类和此方法,体现了ReflectionMethod在类与方法反射方面的应用,属于信息技术中反射机制相关内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

new ReflectionMethod($class, $method)

反射回类和此方法


visibility_of_element_locatedself = <Response [404]>, kwargs = {} def json(self, **kwargs): r"""Returns the json-encoded content of a response, if any. :param \*\*kwargs: Optional arguments that ``json.loads`` takes. :raises requests.exceptions.JSONDecodeError: If the response body does not contain valid json. """ if not self.encoding and self.content and len(self.content) > 3: # No encoding set. JSON RFC 4627 section 3 states we should expect # UTF-8, -16 or -32. Detect which one to use; If the detection or # decoding fails, fall back to `self.text` (using charset_normalizer to make # a best guess). encoding = guess_json_utf(self.content) if encoding is not None: try: return complexjson.loads(self.content.decode(encoding), **kwargs) except UnicodeDecodeError: # Wrong UTF codec detected; usually because it's not UTF-8 # but some other 8-bit codec. This is an RFC violation, # and the server didn't bother to tell us what codec *was* # used. pass except JSONDecodeError as e: raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) try: > return complexjson.loads(self.text, **kwargs) ..\..\..\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\models.py:974: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ..\..\..\AppData\Local\Programs\Python\Python312\Lib\json\__init__.py:346: in loads return _default_decoder.decode(s) ..\..\..\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py:337: in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <json.decoder.JSONDecoder object at 0x000001C9BA088200> s = '<!doctype html>\n<html>\n <head>\n <meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="apple-mobile...7ab2d2.js"></script><script src="/home/5be362c.js"></script><script src="/home/b4e1811.js"></script></body>\n</html>\n' idx = 0 def raw_decode(self, s, idx=0): """Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. """ try: obj, end = self.scan_once(s, idx) except StopIteration as err: > raise JSONDecodeError("Expecting value", s, err.value) from None E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) ..\..\..\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py:355: JSONDecodeError During handling of the above exception, another exception occurred: self = <类的方式做接口.TestAdd object at 0x000001C9BA3BCF20> def test_delete(self): d = Customer() > res = d.delete(uid=77407) 类的方式做接口.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 类的方式做接口.py:53: in delete return d.json() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Response [404]>, kwargs = {} def json(self, **kwargs): r"""Returns the json-encoded content of a response, if any. :param \*\*kwargs: Optional arguments that ``json.loads`` takes. :raises requests.exceptions.JSONDecodeError: If the response body does not contain valid json. """ if not self.encoding and self.content and len(self.content) > 3: # No encoding set. JSON RFC 4627 section 3 states we should expect # UTF-8, -16 or -32. Detect which one to use; If the detection or # decoding fails, fall back to `self.text` (using charset_normalizer to make # a best guess). encoding = guess_json_utf(self.content) if encoding is not None: try: return complexjson.loads(self.content.decode(encoding), **kwargs) except UnicodeDecodeError: # Wrong UTF codec detected; usually because it's not UTF-8 # but some other 8-bit codec. This is an RFC violation, # and the server didn't bother to tell us what codec *was* # used. pass except JSONDecodeError as e: raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) try: return complexjson.loads(self.text, **kwargs) except JSONDecodeError as e: # Catch JSON-related errors and raise as requests.JSONDecodeError # This aliases json.JSONDecodeError and simplejson.JSONDecodeError > raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) E requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0) ..\..\..\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\models.py:978: JSONDecodeError 响应状态码: {'status': 400, 'msg': "SQLSTATE[HY000]: General error: 1364 Field 'account' doesn't have a default value", 'data': {'message': "SQLSTATE[HY000]: General error: 1364 Field 'account' doesn't have a default value", 'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-orm/src/db/PDOConnection.php', 'line': 771, 'trace': [{'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-orm/src/db/PDOConnection.php', 'line': 827, 'function': 'getPDOStatement', 'class': 'think\\db\\PDOConnection', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-orm/src/db/PDOConnection.php', 'line': 797, 'function': 'queryPDOStatement', 'class': 'think\\db\\PDOConnection', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-orm/src/db/PDOConnection.php', 'line': 911, 'function': 'pdoExecute', 'class': 'think\\db\\PDOConnection', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-orm/src/db/BaseQuery.php', 'line': 960, 'function': 'insert', 'class': 'think\\db\\PDOConnection', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-orm/src/Model.php', 'line': 696, 'function': 'insert', 'class': 'think\\db\\BaseQuery', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-orm/src/db/PDOConnection.php', 'line': 1377, 'function': 'think\\{closure}', 'class': 'think\\Model', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-orm/src/db/concern/Transaction.php', 'line': 82, 'function': 'transaction', 'class': 'think\\db\\PDOConnection', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-orm/src/Model.php', 'line': 711, 'function': 'transaction', 'class': 'think\\db\\BaseQuery', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-orm/src/Model.php', 'line': 534, 'function': 'insertData', 'class': 'think\\Model', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-orm/src/Model.php', 'line': 842, 'function': 'save', 'class': 'think\\Model', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/app/dao/BaseDao.php', 'line': 321, 'function': 'create', 'class': 'think\\Model', 'type': '::'}, {'function': 'save', 'class': 'app\\dao\\BaseDao', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/app/services/BaseServices.php', 'line': 154, 'function': 'call_user_func_array'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/app/adminapi/controller/v1/user/User.php', 'line': 163, 'function': '__call', 'class': 'app\\services\\BaseServices', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-orm/src/db/PDOConnection.php', 'line': 1377, 'function': 'app\\adminapi\\controller\\v1\\user\\{closure}', 'class': 'app\\adminapi\\controller\\v1\\user\\User', 'type': '->'}, {'function': 'transaction', 'class': 'think\\db\\PDOConnection', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-orm/src/DbManager.php', 'line': 394, 'function': 'call_user_func_array'}, {'function': '__call', 'class': 'think\\DbManager', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Facade.php', 'line': 96, 'function': 'call_user_func_array'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/app/services/BaseServices.php', 'line': 82, 'function': '__callStatic', 'class': 'think\\Facade', 'type': '::'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/app/adminapi/controller/v1/user/User.php', 'line': 174, 'function': 'transaction', 'class': 'app\\services\\BaseServices', 'type': '->'}, {'function': 'save', 'class': 'app\\adminapi\\controller\\v1\\user\\User', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Container.php', 'line': 344, 'function': 'invokeArgs', 'class': 'ReflectionMethod', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/route/dispatch/Controller.php', 'line': 110, 'function': 'invokeReflectMethod', 'class': 'think\\Container', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 59, 'function': 'think\\route\\dispatch\\{closure}', 'class': 'think\\route\\dispatch\\Controller', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 66, 'function': 'think\\{closure}', 'class': 'think\\Pipeline', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/route/dispatch/Controller.php', 'line': 113, 'function': 'then', 'class': 'think\\Pipeline', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/route/Dispatch.php', 'line': 90, 'function': 'exec', 'class': 'think\\route\\dispatch\\Controller', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Route.php', 'line': 785, 'function': 'run', 'class': 'think\\route\\Dispatch', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 59, 'function': 'think\\{closure}', 'class': 'think\\Route', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/app/adminapi/middleware/AdminLogMiddleware.php', 'line': 39, 'function': 'think\\{closure}', 'class': 'think\\Pipeline', 'type': '->'}, {'function': 'handle', 'class': 'app\\adminapi\\middleware\\AdminLogMiddleware', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Middleware.php', 'line': 142, 'function': 'call_user_func'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 85, 'function': 'think\\{closure}', 'class': 'think\\Middleware', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/app/adminapi/middleware/AdminCheckRoleMiddleware.php', 'line': 44, 'function': 'think\\{closure}', 'class': 'think\\Pipeline', 'type': '->'}, {'function': 'handle', 'class': 'app\\adminapi\\middleware\\AdminCheckRoleMiddleware', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Middleware.php', 'line': 142, 'function': 'call_user_func'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 85, 'function': 'think\\{closure}', 'class': 'think\\Middleware', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/app/adminapi/middleware/AdminAuthTokenMiddleware.php', 'line': 59, 'function': 'think\\{closure}', 'class': 'think\\Pipeline', 'type': '->'}, {'function': 'handle', 'class': 'app\\adminapi\\middleware\\AdminAuthTokenMiddleware', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Middleware.php', 'line': 142, 'function': 'call_user_func'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 85, 'function': 'think\\{closure}', 'class': 'think\\Middleware', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/app/http/middleware/AllowOriginMiddleware.php', 'line': 50, 'function': 'think\\{closure}', 'class': 'think\\Pipeline', 'type': '->'}, {'function': 'handle', 'class': 'app\\http\\middleware\\AllowOriginMiddleware', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Middleware.php', 'line': 142, 'function': 'call_user_func'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 85, 'function': 'think\\{closure}', 'class': 'think\\Middleware', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 66, 'function': 'think\\{closure}', 'class': 'think\\Pipeline', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Route.php', 'line': 786, 'function': 'then', 'class': 'think\\Pipeline', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Http.php', 'line': 216, 'function': 'dispatch', 'class': 'think\\Route', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Http.php', 'line': 206, 'function': 'dispatchToRoute', 'class': 'think\\Http', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 59, 'function': 'think\\{closure}', 'class': 'think\\Http', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-multi-app/src/MultiApp.php', 'line': 71, 'function': 'think\\{closure}', 'class': 'think\\Pipeline', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 59, 'function': 'think\\app\\{closure}', 'class': 'think\\app\\MultiApp', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 66, 'function': 'think\\{closure}', 'class': 'think\\Pipeline', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/think-multi-app/src/MultiApp.php', 'line': 72, 'function': 'then', 'class': 'think\\Pipeline', 'type': '->'}, {'function': 'handle', 'class': 'think\\app\\MultiApp', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Middleware.php', 'line': 142, 'function': 'call_user_func'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 85, 'function': 'think\\{closure}', 'class': 'think\\Middleware', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/app/http/middleware/BaseMiddleware.php', 'line': 45, 'function': 'think\\{closure}', 'class': 'think\\Pipeline', 'type': '->'}, {'function': 'handle', 'class': 'app\\http\\middleware\\BaseMiddleware', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Middleware.php', 'line': 142, 'function': 'call_user_func'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 85, 'function': 'think\\{closure}', 'class': 'think\\Middleware', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/middleware/LoadLangPack.php', 'line': 57, 'function': 'think\\{closure}', 'class': 'think\\Pipeline', 'type': '->'}, {'function': 'handle', 'class': 'think\\middleware\\LoadLangPack', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Middleware.php', 'line': 142, 'function': 'call_user_func'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 85, 'function': 'think\\{closure}', 'class': 'think\\Middleware', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/middleware/SessionInit.php', 'line': 67, 'function': 'think\\{closure}', 'class': 'think\\Pipeline', 'type': '->'}, {'function': 'handle', 'class': 'think\\middleware\\SessionInit', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Middleware.php', 'line': 142, 'function': 'call_user_func'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 85, 'function': 'think\\{closure}', 'class': 'think\\Middleware', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Pipeline.php', 'line': 66, 'function': 'think\\{closure}', 'class': 'think\\Pipeline', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Http.php', 'line': 207, 'function': 'then', 'class': 'think\\Pipeline', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/vendor/topthink/framework/src/think/Http.php', 'line': 170, 'function': 'runWithRequest', 'class': 'think\\Http', 'type': '->'}, {'file': '/www/wwwroot/v5.crmeb.net/crmeb/public/index.php', 'line': 39, 'function': 'run', 'class': 'think\\Http', 'type': '->'}], 'previous': None}} PASSED 进程已结束,退出代码为 1
最新发布
07-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值