ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### 安装PHP扩展类库 Using the PHP Library for MongoDB (PHPLIB) ##### 1. 添加php.exe程序目录到系统环境变量PATH 右击桌面上「计算机」,选择「属性」,选择「高级系统设置」,点击「环境变量」。 在系统变量中找到「Path」并双击,在变量值内最前端添加:`D:\phpStudy\PHPTutorial\php\php-7.2.1-nts.` ##### 2. 复制 composer.phar 文件到 ThinkPHP的安装目录的根目录下: ~~~ composer.phar ~~~ ##### 3. 测试 composer.phar ~~~ D:\phpStudy\PHPTutorial\WWW\workspace\report>php composer.phar ______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/ Composer version 1.6.5 2018-05-04 11:44:59 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question --profile Display timing and memory usage information --no-plugins Whether to disable plugins. -d, --working-dir=WORKING-DIR If specified, use the given directory as workin g directory. -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for norma l output, 2 for more verbose output and 3 for debug Available commands: about Shows the short information about Composer. archive Creates an archive of this composer package. browse Opens the package's repository URL or homepage in your br owser. check-platform-reqs Check that platform requirements are satisfied. clear-cache Clears composer's internal package cache. clearcache Clears composer's internal package cache. config Sets config options. create-project Creates new project from a package into given directory. depends Shows which packages cause the given package to be instal led. diagnose Diagnoses the system to identify common errors. dump-autoload Dumps the autoloader. dumpautoload Dumps the autoloader. exec Executes a vendored binary/script. global Allows running commands in the global composer dir ($COMP OSER_HOME). help Displays help for a command home Opens the package's repository URL or homepage in your br owser. info Shows information about packages. init Creates a basic composer.json file in current directory. install Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json. licenses Shows information about licenses of dependencies. list Lists commands outdated Shows a list of installed packages that have updates avai lable, including their latest version. prohibits Shows which packages prevent the given package from being installed. remove Removes a package from the require or require-dev. require Adds required packages to your composer.json and installs them. run-script Runs the scripts defined in composer.json. search Searches for packages. self-update Updates composer.phar to the latest version. selfupdate Updates composer.phar to the latest version. show Shows information about packages. status Shows a list of locally modified packages, for packages i nstalled from source. suggests Shows package suggestions. update Upgrades your dependencies to the latest version accordin g to composer.json, and updates the composer.lock file. upgrade Upgrades your dependencies to the latest version accordin g to composer.json, and updates the composer.lock file. validate Validates a composer.json and composer.lock. why Shows which packages cause the given package to be instal led. why-not Shows which packages prevent the given package from being installed. D:\phpStudy\PHPTutorial\WWW\workspace\report> ~~~ ##### 4. 运行composer require,安装mongodb/mongodb依赖 ~~~ composer require mongodb/mongodb ~~~ 输出 ~~~ D:\phpStudy\PHPTutorial\WWW\workspace\report>composer require mongodb/mongodb Using version ^1.3 for mongodb/mongodb ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 1 install, 0 updates, 0 removals - Installing mongodb/mongodb (1.3.2): Downloading (100%) Package activecollab/etcd is abandoned, you should avoid using it. No replacemen t was suggested. Writing lock file Generating autoload files ~~~ * * * * * http://php.net/manual/en/mongodb.tutorial.library.php