Home >php教程 >php手册 >php cli sapi执行php代码的几种方式

php cli sapi执行php代码的几种方式

WBOY
WBOYOriginal
2016-06-06 20:14:241469browse

1. php -r php codes param1 param2 2. php -f filename.php param1 param2 3. php -a 4.在php文件头部加上php文件的完整路径 如file.php !#/usr/bin/php?phpecho phpinfo(); 然后给file.php添加执行权限 chmod +x file.php ./file.php 就可以执行文件里面的

1. php -r ‘php codes’ param1 param2…
2. php -f filename.php param1 param2…
3. php -a
4.在php文件头部加上php文件的完整路径
如file.php

!#/usr/bin/php
<?php echo phpinfo();

然后给file.php添加执行权限 chmod +x file.php
./file.php 就可以执行文件里面的php代码了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn