command line interfacelineup是什么意思思

页面导航:
→ 正文内容 php-cli简介
php-cli简介(不会Shell语言一样用Shell)
刚才说到,我们可以用php来开发Shell程序。有的同学可能会问啦:php不是用来做网页的么?。是的,php可以用来做动态网页,并且当初php就是为做动态网页而开发的语言,但是理论上php可以用来做任何的程序,甚至是桌面程序
1.基础知识 1.1 什么是Shell编程? 在 Unix 中,shell 可不是简单的命令解释器(典型的有 Windows 中的 DOS ),而是一个全功能的编程环境。Shell 是操作系统的一部分,用来与用户打交道,并且可以用来协调各个命令【1】。用Shell编程可以灵活地解决大量重复任务,十分方便。但是,Shell的语法十分怪异(个人意见),不容易记,如果现在熟悉的语言可以用来写shell那就好了――比如php――就可以快速开发Shell程序了(比如我的Preminder的后台程序),于是便有了这篇文章,本文以Linux为例说明php-cli的用法,其它平台的版本类似。 1.2 什么是php-cli? 刚才说到,我们可以用php来开发Shell程序。有的同学可能会问啦:“php不是用来做网页的么?-_-”。是的,php可以用来做动态网页,并且当初php就是为做动态网页而开发的语言,但是理论上php可以用来做任何的程序,甚至是桌面程序,而php-cli是php在命令行运行的支持环境,也就是我们说的可以用来写Shell的环境支持。 php-cli是php Command Line Interface的简称,如同它名字的意思,就是php在命令行运行的接口,区别于在Web服务器上运行的php环境(php-cgi, isapi等)【2】。 也就是说,php不单可以写前台网页,它还可以用来写后台的程序。 2. 执行php-cli脚本 2.1 php-cli的语法 当然是跟php一模一样啦,因为它就是php嘛!只不过一些默认的参数与php-cgi不同,比如运行时间:php-cli默认运行时间是无穷,而网页php默认设置是30s。 2.2 执行php-cli脚本 2.2.1. 直接在终端执行php kangzj@localhost# php -r 'print_r(get_defined_constants());'2.2.2. 运行php-cli脚本文件 kangzj@localhost# php my_script.php kangzj@localhost# php -f my_script.php上而说的php文件就是一般的php文件没有什么不同。还有一种方式,就是在文件中指令解释器,就可以直接在终端以”./test.php执行脚本了”,test.php就像下面这样:
代码如下:#!/usr/bin/php -q &?php echo "Hello world of PHP CLI!"; ?& 补充:php的Shell程序并不一定以php为扩展名,可以以任意扩展名,甚至不要扩展名,只是为了清楚,我才用的php扩展名。 2.2.3. 用Cron执行php-cli脚本 cron是一个linux下的定时执行工具,可以在无需人工干预的情况下运行作业,周期性作业,比如备份数据,Preminder定期查询PR等等,添加的方法:打开/etc/crontab,添加: 0 13 * * * /usr/bin/php -f /home/phpscripts/phpcli.php 4. 结语 如果你会php的话,那么你也会了一种Shell编程语言! 如果你不会php,你去学php,就相当于一下子学会动态网页和Shell两种语言!并且你甚至可以用php来写具有图形界面的应用程序,Dnspod的动态域名客户端中就有一种是用php开发的。 php的易学是出名的,如果你还不会,那是在犹豫什么呢? 另外,再宣传一下我的”Preminder”――PR更新Email提醒服务~~ 5. 参考文献 1.Linux Shell简介 : 2.PHP Command Line Interface : Mystic Unleashed : 3.ch 4.2, php manual :
PS:Shell命令还是要知道一些的,否则有些功能不太好实现。
您可能感兴趣的文章:
上一篇:下一篇:
最 近 更 新
热 点 排 行
12345678910命令行界面;
生活指数( Cost of Living Index );
IBM Lotus国际认证讲师;
Command Line Interface
命令行界面(Command Line Interface);
命令行接口;
命令行(commandline)
大家都在背:
1. You will now enter CLI mode.
现在,您将进入CLI模式.
来自互联网
2. You can skip the setup wizard, and enter CLI mode to manually configure the switch.
您可以跳过此设置向导而进入CLI模式手动配置交换机.
来自互联网
3. Note that several examples and scenarios, including command - line interface ( CLI ) configuration and show commands, are analyzed.
注意:这里还将分析几个事例和场景, 包括命令行接口 ( CLI ) 配置和显示命令.
来自互联网
4. The default role, root
cli, connects to the root
cimv 2 namespace to operate on the classes within root
默认的作用, 根cli的, 连接到rootcimv2命名空间操作的班级内根cimv2.
来自互联网
5. Figure 1 shows the root
cli node and some of the properties in the MSFT _ CliAlias class.
图1显示了根cli的节点和一些物业MSFT_CliAlias类.
来自互联网
1. a user interface in which you type commands instead of choosing them from a menu or selecting an icon
CLI的全称:
未分类的(50)
Calling Line Identification
主叫用戶識別
Command Line Interface
命令行界面
Command Line Interpreter
命令总线解释程序
Call Level Interface
调用级界面
Caller's Line Identification (Pakistan)
来电者的线路标识(巴基斯坦)
Calling Line Identifier
呼叫线标识符
Canon Law Institute
佳能法律研究所
Center for Logistics Innovation (US Army)
中心(美国军队后勤改革)
Certified Legal Investigator
注册合法研究人员
Clear Interrupt Flag
清晰的中断标志
1. 命令行界面(Command Line Interface)
命令行界面(CLI)的了解,从而降低了部署成本。 出色的冗余性用于出故障时的备份 Cisco UplinkFast和BackboneFast技术能确保 …
- 基于9168个网页
2. 命令行接口
从命令行接口(CLI)运行index.php,它应该会在Data文件夹里面生成20个带有格式ARTIST-ID.html的HTML文件。把这20个文件拷贝到 …
- 基于6199个网页
在命令行(CLI)模式下 phpinfo() 仅会输出纯文本,而不是HTML。 // 显示所有信息,默认显示 INFO_ALLphpinfo();// Show just the m…
- 基于3790个网页
4. 命令行(commandline)
在命令行(CLI)模式下 phpinfo() 仅会输出纯文本,而不是HTML。 // 显示所有信息,默认显示 INFO_ALLphpinfo();// Show just the m…
- 基于1886个网页
1. 安全备份
...固件升级,端口镜像,VLAN镜像,DHCP,可编辑文本配置文件,智能端口, 安全备份,Textview CLI,云服务,本地化, 网管支持网络用户界面,SNMP,SNMP MIBs, 远程监控.
- 基于2个网页
1. 产品的特点
INFORMIX SDK 是 INFORMIX 提供的应用界面 ( API ) 的一个集合。
INFORM ... INFORMIX CLI产品的特点全球语言支持(GLS) 全球语言支持功能存在于INFORMIX 7.
- 基于2个网页
1. 压缩实验室公司
...CLI CommandLanguageInterpreter 命令语言注释器CLI CompressionLabsInc 压缩实验室公司(美国,出品视频会议设备)-
- 基于4个网页
1. 基本配置
ChinaUnix 网络频道为网友提供最新的网络技术资讯、技术文档,同时为广大网络技术爱好者提供一个方便的交流社区。 Juniper CLI基本配置(小结) - 路由/交换
- 基于3个网页
简介 CLI(command-line interface,命令行界面)是指可在用户提示符下键入可执行指令的界面。 CLI是Command Line Interface的缩写,即命令行界面。CLI界面是所有路由器、TM(Termination Multiplexer,终端复用器)、CM(Cable Modem,电缆调制解调器)等产品提供的界面,如CISCO, LUCENT,Arris, 华为等。它是路由器产品的标准。目前市场上有些产品为了降低成本,不提供CONSOLE口,因此不能使用CLI。使用CLI具有使用要求低(
本内容来源于
以上内容来自百度百科平台,由百度百科网友创作。
0){var rand = parseInt(Math.random() * (000)+100000);top.location.href='/'+encodeURIComponent(document.getElementById('s').value.trim().replace( / /g, '_'))+'?renovate='+}else{top.location.href='/'+encodeURIComponent(document.getElementById('s').value.trim().replace( / /g, '_'));};}" action="/">
查过的词自动加入生词本
Tip:此功能设置只能在登录状态下生效
需要改进的内容:
单词大小写
其他(请在下面补充描述)
错误描述:
您还可在这里补充说明下 O(∩_∩)O~
方便的话,请您留下一种联系方式,便于问题的解决:PhoneGap API Documentation
API Reference
This guide shows you how to create applications and deploy them to
various native mobile platforms using the cordova command-line
interface (CLI). This tool allows you to create new projects, build
them on different platforms, and run on real devices or within emulators. The CLI
is the main tool to use for the cross-platform workflow (See the
for a description
of the various workflows.)
However, you can also use the CLI to initialize project code, after
which you use various platforms' SDKs and shell tools for continued development.
Before running any command-line tools, you need to install SDKs for
each platform you wish to target.
for more details.)
To add support or rebuild a project for any platform, you need to run
the command-line interface from the same machine that supports the
platform's SDK. The CLI supports the following combinations:
Amazon Fire OS
(Mac, Linux, Windows)
(Mac, Linux)
BlackBerry 10
(Mac, Linux, Windows)
Windows Phone 7 (Windows)
Windows Phone 8 (Windows)
Firefox OS
(Mac, Linux, Windows)
On the Mac, the command-line is available via the Terminal
application. On the PC, it's available as Command Prompt under
Accessories.
The more likely it is that you run the CLI from different machines,
the more it makes sense to maintain a remote source code repository,
whose assets you pull down to local working directories.
To install the cordova command-line tool, follow these steps:
Download and install . Following
installation, you should be able to invoke node or npm on your
command line.
Install the cordova utility. In Unix, prefixing the additional
sudo command may be necessary to install development utilities in
otherwise restricted directories:
$ sudo npm install -g cordova
The installation log may produce errors for any uninstalled
platform SDKs.
Following installation, you should be able to run
cordova on the command line.
NOTE: The -g flag above tells npm to install cordova globally.
You may need to add the npm directory to your PATH in order to invoke
globally installed npm modules. On Windows, npm can usually be found at
C:\Users\username\AppData\Roaming\npm and on Unix at
/usr/local/share/npm.
Go to the directory where you maintain your source code, and run a
command such as the following:
$ cordova create hello com.example.hello HelloWorld
It may take some time for the command to complete, so be patient. Running
the command with the -d option displays information about its progress.
The first argument specifies a hello directory to be generated
for your project. Its www subdirectory houses your application's
home page, along with various resources under css, js, and img,
which follow common web development file-naming conventions. The
config.xml file contains important metadata needed to generate and
distribute the application.
The other two arguments are optional: the com.example.hello argument
provides your project with a reverse domain-style identifier, and the
HelloWorld provides the application's display text. You can edit
both of these values later in the config.xml file.
All subsequent commands need to be run within the project's directory,
or any subdirectories within its scope:
$ cd hello
Before you can build the project, you need to specify a set of target
platforms. Your ability to run these commands depends on whether your
machine supports each SDK, and whether you have already installed each
Run any of these from a Mac:
$ cordova platform add ios
$ cordova platform add amazon-fireos
$ cordova platform add android
$ cordova platform add blackberry10
$ cordova platform add firefoxos
Run any of these from a Windows machine, where wp refers to
different versions of the Windows Phone operating system:
$ cordova platform add wp7
$ cordova platform add wp8
$ cordova platform add windows8
$ cordova platform add amazon-fireos
$ cordova platform add android
$ cordova platform add blackberry10
$ cordova platform add firefoxos
Run this to check your current set of platforms:
$ cordova platforms ls
(Note the platform and platforms commands are synonymous.)
Run either of the following synonymous commands to remove a platform:
$ cordova platform remove blackberry10
$ cordova platform rm amazon-fireos
$ cordova platform rm android
Running commands to add or remove platforms affects the contents of
the project's platforms directory, where each specified platform
appears as a subdirectory. The www source directory is reproduced
within each platform's subdirectory, appearing for example in
platforms/ios/www or platforms/android/assets/www. Because the CLI
constantly copies over files from the source www folder, you should only
edit these files and not the ones located under the platforms subdirectories.
If you use version control software, you should add this source www folder,
along with the merges folder, to your version control system. (More information
about the merges folder can be found in the Customize Each Platform section below.)
WARNING: When using the CLI to build your application, you are strongly discouraged
from editing any files in the /platforms/ folder unless you know what you are doing
or are specifically told otherwise in documentation. This is because the files in the
/platforms/ directory will be overwritten on prepare or plugin reinstallation.
If you wish at this point, you can use an SDK such as Eclipse or Xcode
to open the project you created. You will need to open the derivative set of assets
from the /platforms/ directory to develop with an SDK. This is because
the SDK specific metadata files are stored within the appropriate /platform/ subdirectory.
for information on how to develop applications within each IDE.)
Use this approach if you simply want to initialize a project using the CLI and
then switch to an SDK for native work.
Read on if you wish to use the cross-platform workflow approach (the CLI) for the entire
development cycle.
By default, the cordova create script generates a skeletal web-based
application whose home page is the project's www/index.html file.
Edit this application however you want, but any initialization should
be specified as part of the
event handler, referenced by
default from www/js/index.js.
Run the following command to iteratively build the project:
$ cordova build
This generates platform-specific code within the project's platforms
subdirectory.
You can optionally limit the scope of each build to
specific platforms:
$ cordova build ios
The cordova build command is a shorthand for the following, which in
this example is also targeted to a single platform:
$ cordova prepare ios
$ cordova compile ios
In this case, once you run prepare, you can use Apple's Xcode SDK as
an alternative to modify and compile the platform-specific code that
Cordova generates within platforms/ios. You can use the same
approach with other platforms' SDKs.
SDKs for mobile platforms often come bundled with emulators that
execute a device image, so that you can launch the app from the home
screen and see how it interacts with many platform features.
command such as the following to rebuild the app and view it within a
specific platform's emulator:
$ cordova emulate android
Some mobile platforms emulate a particular device by default, such as
the iPhone for iOS projects. For other platforms, you may need to
first associate a device with an emulator.
Note: Emulator support is currently not available for Amazon Fire OS
for details.)
For example, you may first run the android command to launch the
Android SDK, then run a particular device image, which launches it
according to its default behavior:
Following up with the cordova emulate command refreshes the emulator
image to display the latest application, which is now available for
launch from the home screen:
Alternately, you can plug the handset into your computer and test the
app directly:
$ cordova run android
Before running this command, you need to set up the device for
testing, following procedures that vary for each platform. In
Android and Amazon Fire OS devices, you would have to enable a USB debugging option on
the device, and perhaps add a USB driver depending on your development
environmnent.
for details on each platform's requirements.
When you build and view a new project, the default application that
appears doesn't do very much. You can modify the app in many ways to
take advantage of standard web technologies, but for the app to
communicate closely with various device-level features, you need to
add plugins that provide access to core Cordova APIs.
A plugin is a bit of add-on code that provides an interface to
native components. You can design your own plugin interface, for
example when designing a hybrid app that mixes a Cordova WebView with
native components. (See
for details.)
More commonly, you would add a plugin to enable
one of Cordova's basic device-level features
detailed in the . A list of these plugins, including
additional plugins provided by the community, can be found at
. You can use
the CLI to search for plugins from this registry. For example,
searching for bar and code produces a single result that matches
both terms as case-insensitive substrings:
$ cordova plugin search bar code
com.phonegap.plugins.barcodescanner - Scans Barcodes
Searching for only the bar term yields and additional result:
org.apache.cordova.statusbar - Cordova StatusBar Plugin
The cordova plugin add command requires you to specify the
repository for the plugin code.
Please note that when you follow the
Web Project Dev workflow and use the CLI, the CLI will take care of adding
the plugin code to the appropriate place for each platform. (If you are following the
Native Project Dev Workflow, you will have to add plugins using Plugman (guide link here),
multiple times for each platform.)
Here are examples of how you might use the CLI to add features to the app:
Basic device information ( API):
$ cordova plugin add org.apache.cordova.device
and Battery :
$ cordova plugin add org.apache.cordova.network-information
$ cordova plugin add org.apache.cordova.battery-status
$ cordova plugin add org.apache.cordova.device-motion
$ cordova plugin add org.apache.cordova.device-orientation
$ cordova plugin add org.apache.cordova.geolocation
playback and :
$ cordova plugin add org.apache.cordova.camera
$ cordova plugin add org.apache.cordova.media-capture
$ cordova plugin add org.apache.cordova.media
Access files on device or network ( API):
$ cordova plugin add org.apache.cordova.file
$ cordova plugin add org.apache.cordova.file-transfer
via dialog box or vibration:
$ cordova plugin add org.apache.cordova.dialogs
$ cordova plugin add org.apache.cordova.vibration
$ cordova plugin add org.apache.cordova.contacts
$ cordova plugin add org.apache.cordova.globalization
$ cordova plugin add org.apache.cordova.splashscreen
Open new browser windows ():
$ cordova plugin add org.apache.cordova.inappbrowser
Debug console:
$ cordova plugin add org.apache.cordova.console
Use plugin ls (or plugin list, or plugin by itself) to view
currently installed plugins. Each displays by its identifier:
$ cordova plugin ls
# or 'plugin list'
[ 'org.apache.cordova.console' ]
To remove a plugin, refer to it by the same identifier that appears in
the listing. For example, here is how you would remove support for a
debug console from a release version:
$ cordova plugin rm org.apache.cordova.console
$ cordova plugin remove org.apache.cordova.console
You can batch-remove or add plugins by specifying more than one
argument for each command:
$ cordova plugin add org.apache.cordova.console org.apache.cordova.device
When adding a plugin, several options allow you to specify from where
to fetch the plugin. The examples above use a well-known
registry, and the plugin is specified by the
$ cordova plugin add org.apache.cordova.console
The id may also include the plugin's version number, appended after
an @ character. The latest version is an alias for the most recent
version. For example:
$ cordova plugin add org.apache.cordova.console@latest
$ cordova plugin add org.apache.cordova.console@0.2.1
If the plugin is not registered at
but is located in
another git repository, you can specify an alternate URL:
$ cordova plugin add /apache/cordova-plugin-console.git
The git example above fetches the plugin from the end of the master
branch, but an alternate git-ref such as a tag or branch can be
appended after a # character:
$ cordova plugin add /apache/cordova-plugin-console.git#r0.2.0
If the plugin (and its plugin.xml file) is in a subdirectory within
the git repo, you can specify it with a : character. Note that the
# character is still needed:
$ cordova plugin add /someone/aplugin.git#:/my/sub/dir
You can also combine both the git-ref and the subdirectory:
$ cordova plugin add /someone/aplugin.git#r0.0.1:/my/sub/dir
Alternately, specify a local path to the plugin directory that
contains the plugin.xml file:
$ cordova plugin add ../my_plugin_dir
While Cordova allows you to easily deploy an app for many different
platforms, sometimes you need to add customizations.
In that case,
you don't want to modify the source files in various www directories
within the top-level platforms directory, because they're regularly
replaced with the top-level www directory's cross-platform source.
Instead, the top-level merges directory offers a place to specify
assets to deploy on specific platforms. Each platform-specific
subdirectory within merges mirrors the directory structure of the
www source tree, allowing you to override or add files as needed.
For example, here is how you might uses merges to boost the default
font size for Android and Amazon Fire OS devices:
Edit the www/index.html file, adding a link to an additional CSS
file, overrides.css in this case:
&link rel="stylesheet" type="text/css" href="css/overrides.css" /&
Optionally create an empty www/css/overrides.css file, which would
apply for all non-Android builds, preventing a missing-file error.
Create a css subdirectory within merges/android, then add a
corresponding overrides.css file. Specify CSS that overrides the
12-point default font size specified within www/css/index.css, for
body { font-size:14 }
When you rebuild the project, the Android version features the custom
font size, while others remain unchanged.
You can also use merges to add files not present in the original
www directory. For example, an app can incorporate a back button
graphic into the iOS interface, stored in
merges/ios/img/back_button.png, while the Android version can
instead capture
events from the corresponding hardware
Cordova features a couple of global commands, which may help you if
you get stuck or experience a problem.
The help command displays
all available Cordova commands and their syntax:
$ cordova help
The info command produces a listing of potentially useful details,
such as currently installed platforms and plugins, SDK versions for
each platform, and versions of the CLI and node.js:
$ cordova info
It both presents the information to screen and captures the output in
a local info.txt file.
NOTE: Currently, only details on iOS and Android platforms are
available.
After installing the cordova utility, you can always update it to
the latest version by running the following command:
$ sudo npm update -g cordova
Use this syntax to install a specific version:
$ sudo npm install -g cordova@3.1.0
Run cordova -v to see which version is currently running.
Run the npm
info command for a longer listing that includes the current version
along with other available version numbers:
$ npm info cordova
Cordova 3.0 is the first version to support the command-line interface
described in this section. If you are updating from a version prior to
3.0, you need to create a new project as described above, then copy
the older application's assets into the top-level www directory.
Where applicable, further details about upgrading to 3.0 are available
Once you upgrade to the cordova
command-line interface and use npm update to stay current, the more
time-consuming procedures described there are no longer relevant.
Cordova 3.0+ may still require various changes to
project-level directory structures and other dependencies. After you
run the npm command above to update Cordova itself, you may need to
ensure your project's resources conform to the latest version's
requirements. Run a command such as the following for each platform
you're building:
$ cordova platform update android
$ cordova platform update ios

我要回帖

更多关于 加line是什么意思 的文章

 

随机推荐