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

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

WBOY
Release: 2016-06-06 20:14:24
Original
1472 people have browsed it

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();
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template