| 域名空间 下载中心 社区论坛 信息公告 my小屋 |
![]() |
联系我们 设为首页 加入收藏 |
|
首页 | 新闻资讯 | 编程开发 | 网页设计 | 图形图象 | 网络媒体 | 网站模板 | 数 据 库 | 投稿 论坛 | 操作系统 | 系统优化 | 网络安全 | 黑客技术 | 硬件学堂 | 硬件报价 | 服 务 器 | 地图 专题 | 应用软件 | 聊天通讯 | q q 专栏 | 建站经验 | 在线工具 | 站长club | 注 册 表 | 旧版 社会 | 游戏娱乐 | 设计欣赏 | 疑难解答 | 社区论坛 | 韩国素材 | 素材图库 | 广告服务 | 服务 |
| 新版上线![旧版] | |||||
注:打开慢时请稍等
关于php在命令行下如何接受参数的问题http://www.iyit.net 日期:2006-10-6 15:41:44 来源:iyit.net收集 点击: |
//test.php <?php echo $a; ?> //---------------------------- 在命令行下用 php.exe test.php即可, 但是变量$a的值怎么给呢?? test.php?a=100例,在网页中可以如此调用,而test.php也可以得到a的值, 在命令行中如何输入呢 --------------------------------------------------------------- i think you can set up environment variables to do that, for example, if you are using microsoft windows, try c:\>set a=100 c:\>php test.php or you can add this line to your code: $a=$argv[1]; then do c:\>php test.php 100 --------------------------------------------------------------- php预定义的变量: 'argv' array of arguments passed to the script. when the script is run on the command line, this gives c-style access to the command line parameters. when called via the get method, this will contain the query string. 'argc' contains the number of command line parameters passed to the script (if run on the command line). 命令: x:\phppath\php test.php arg1 arg2 arg3 test.php是第0个参数 test.php: <? echo $argc."个参数\n"; print_r($argv); ?> --------------------------------------------------------------- accorind to this: http://php.libero.it/manual/en/features.commandline.php you should do php a.php "&a=100" anyone confirm? (i don't have php) 编辑:黑鹰 [发送给好友] [打印本页] [关闭窗口] [返回顶部] 上一篇:关于树形回复的字符串操作问题 下一篇:php中怎样来访获得ip地址? 转载请注明来源:www.iyit.net 特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。 |
| 最新更新 | 热点排行 | 推荐新闻 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 设置首 页 - 版权声明 - 广告服务 - 关于我们 - 联系我们 - 友情连接 |
| |||||||