Command Line

2018-07-16 10:14:59
tengfei
7146
Last edited by tengfei on 2019-01-08 09:59:25

In addition to the extension mechanism and the API mechanism, zentaoPHP also provides the entry of the command line to control the application.


1. What is command line entry?

Applications developed in zentaoPHP have a centralized entry. Take ZenTao project management software for example. www/index.php is the entry that is important and used by everyone. www/install.php and www/upgrade.php, as the names imply, are entries for the installation and upgrading. Among the three entries, index.php is with access control, and install.php and upgrade.php do not have it and they only function under specific circumstances. After normal installation or upgrade, it is invalid to visit install.php or upgrade.php.


The command line entry is located at bin/ztcli. Actually, it is coded in PHP and is mainly used by the system administrator. Through this entry, each page of ZenTao can be accessed, thus it is convenience for various operations.


2. How to use command line basically?

The command line entry has three files, ztcli, ztcli.sh and ztcli.bat. ztcli is the main PHP script , and the other two are encapsulation for convenience. First, look at the execution of the main script.


Execute the following command in the bin directory (it must be in the bin directory. )

Syntax format: PHP ztcli http://xxxx/zentaopms/xxxxx (where PHP, if not found, is replaced by the absolute path of PHP executable file).

For example, the access path of my ZenTao is http://pms.zentao.net. I want to trigger the update program of the burndown chart. The command is as follows:

php ztcli http://pms.zentao.net/project-computeburn.html



If you configure the ZenTao through GET, then the command is:  



php ztcli "http://pms.zentao.net/? M=project&f=computeburn" 


(the URL address behind it has to be quoted.)

That is to say, what you see in the browser can be accessed through ztcli.


3. Encapsulation

If your PHP executable file is not in the path, you can modify ztcli.sh (Linux) or ztcli.bat (Windows) to complete the path.

For example, in ztcli.bat, write d:\zentao\user\local\php\php.exe ztcl% *

After encapsulation, you can directly run the ztclibat URL address.


4. Advanced

When you visit the page of the ZenTao, you can change the resources you visit. For example, http://pms.zentao.net/project-task-8.html. Change the page format from .html to .json, guess what is returned? The data returned is in the JSON. If it is GET, you only need to change the parameter of t to JSON, which is http://pms.zentao.cn/? M=project&f=task&t=json.


Write a Comment
Comment will be posted after it is reviewed.