这篇文章给大家分享的是有关怎么解决ThinkPHP5.1版本引入composer vendor扩展包的问题的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
下面由thinkphp框架教程栏目给大家介绍解决ThinkPHP5.1版本引入composer vendor扩展包的问题,希望对需要的朋友有所帮助!
旧版本:ThinkPHP5.0新版本:ThinkPHP5.1
问题:TP5.1 中取消了 Loader::import 方法以及import和vendor助手函数,全部采用命名空间和自动加载机制,导致引入类库找不到报错
解决:因为“全部采用命名空间和自动加载机制”,所以对 composer/installed.json 做了修改(文字说明在下方注释中)
{
"name": "curl/curl",
"version": "2.3.0",
"version_normalized": "2.3.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-mod/curl.git",
"reference": "3ad560b1fc1bbdf5c7681356ab953fb961f255e5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-mod/curl/zipball/3ad560b1fc1bbdf5c7681356ab953fb961f255e5",
"reference": "3ad560b1fc1bbdf5c7681356ab953fb961f255e5",
"shasum": ""
},
"require": {
"ext-curl": "*",
"php": "^5.6 | ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"squizlabs/php_codesniffer": "~2.1"
},
"time": "2020-03-19T20:07:26+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"Curl": "src/"
},
//在此处添加 files 字段,把类库文件的相对路径填入
"files":[
"vendor/curl/curl/src/Curl/Curl.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "php-curl-class",
"homepage": "https://github.com/php-curl-class"
},
{
"name": "Hassan Amouhzi",
"email": "hassan@anezi.net",
"homepage": "http://hassan.amouhzi.com"
},
{
"name": "user52",
"homepage": "https://github.com/user52"
}
],
"description": "cURL class for PHP",
"homepage": "https://github.com/php-mod/curl",
"keywords": [
"curl",
"dot"
]
}
感谢各位的阅读!关于“怎么解决ThinkPHP5.1版本引入composer vendor扩展包的问题”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。