(本文灵感来自https://blog.csdn.net/hxh5801050/article/details/78241215, Code_星华)
其实我主要是想搞那个phpsipder,没想到却搞了一通这。。。(这个跟 Code_星华 的原因是一样的,结果也一样。。。无语)
正题:直接上码
下载:
curl -O https://getcomposer.org/composer.phar
我在这里前,到home文件夹新建了文件夹a,composr.phar就在a里面了。
燃后,重命名:
mv composer.phar composer
之后搬家:
mv composer /usr/local/bin/
到此为止,我不知道别人怎么搞,反正我是无法看到任何composer的信息,不论怎样调试,始终显示
“The program 'composer' is currently not installed. You can install it by typing:
apt install composer”
搬家后,显示为:
“bash: /usr/local/bin/composer: Permission denied”
只有下一步,才能实现那些个参数等,
最后,授权:
chmod +x /usr/local/bin/composer
这个完了以后,composer,就可以看到
Do not run Composer as root/super user! See https://getcomposer.org/root for details
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 1.8-dev (af677553cce0967bf7c364d64a9a169152c33fcd) 2018-09-13 07:28:04
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 working directory.
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal 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 browser.
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 installed.
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 ($COMPOSER_HOME).
help Displays help for a command
home Opens the package's repository URL or homepage in your browser.
i Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
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 available, 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 installed from source.
suggests Shows package suggestions.
u Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.
update Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.
upgrade Upgrades your dependencies to the latest version according 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 installed.
why-not Shows which packages prevent the given package from being installed.
希望帮到你。
下面是记录ThinkCMF的用法:
系统端:
cd到cmf根目录,在运行一遍composer
composer require jaeger/querylist
会有一大段黄色的Warning,不管他,主要说的是已经帮你映射到了think框架里了,
然后cd到app文件夹(非5.0以上版本,可能叫application文件夹)新建一个api文件夹(如果已经下载了api插件的清忽略),
写入代码:
vi PhpsipderController.php
find('img')->attrs('src');
//打印结果
print_r($data->all());
}
}
然后保存,在访问http://域名/api/phpsipder
输出是Array(***)
测试OK。