1.å¦ä½ä½¿ç¨PHPç交äºå¼è¿è¡ç¯å¢
2.php å¦ä½è°ç¨.net web service
å¦ä½ä½¿ç¨PHPç交äºå¼è¿è¡ç¯å¢
ä»PHP 5.1.0å¼å§ï¼CLI SAPIæä¾äºä¸ä¸ªäº¤äºå¼å½ä»¤è¡å·¥å ·(Interactive shell)ï¼è¿ä¸ªäº¤äºå¼PHP shellæ¯éè¿ä½¿ç¨ âwith-readline ç¼è¯é项éæå°phpå æ ¸éçã使ç¨è¿ä¸ªäº¤äºå¼shellï¼ä½ å¯ä»¥ç´æ¥å¨å½ä»¤è¡çªå£éè¾å ¥PHP并ç´æ¥è·å¾è¾åºç»æã
å¼å¯PHPç交äºå¼shell模å¼ï¼éè¦ä½¿ç¨ -a åæ°ãä¸é¢æ¯ä½¿ç¨äº¤äºå¼shellçä¸äºä¾åã
$ php -a
Interactive shell
php > echo 5+8;
php > function addTwo($n)
php > {
php { return $n + 2;
php { }
php > var_dump(addtwo(2));
int(4)
php >
å¨äº¤äºå¼shelléï¼ä½ å¯ä»¥ä½¿ç¨ tab é®å¯¹å½æ°åï¼å ç½®åéï¼ç±»åï¼éææ¹æ³çè¿è¡èªå¨è¡¥å ¨æä½ã
éè¦æ³¨æçæ¯ï¼Interactive Shell å Interactive Mode 并ä¸æ¯ä¸ä¸ªä¸è¥¿ï¼å°½ç®¡å称ååè½é½å¾ç¸ä¼¼ã
å¦æä½ è¾å ¥ php -a ï¼å¾å°çååºæ¯ âInteractive Shellâ 并è·éç âphp>â æ示符ï¼é£ä½ 使ç¨çå°±æ¯äº¤äºå¼shellãå¦æä½ å¾å°çååºæ¯ âInteractive mode enabledâ ï¼è¯´æä½ çPHP并ä¸æ¯æ交äºå¼shellï¼ä¸é¢ä»ç»çç¨æ³ä¹ä¸å®ç¨äºä½ ã
ä½ä¹ä¸ç¨æ å¿ï¼Interactive mode(交äºæ¨¡å¼)ä¹å¯ä»¥å¨å½ä»¤è¡çªå£éæ§è¡PHP代ç ï¼åªæ¯ä»£ç çæ§è¡æ¹å¼æäºåºå«ãå¨PHP交äºæ¨¡å¼(Interactive mode)éï¼ä½ å¨å½ä»¤è¡çªå£éè¾å ¥PHP代ç ï¼ä»£ç ä¸ä¼ç«å³æ§è¡ï¼å½ä½ è¾å ¥äºææPHP代ç åï¼è¾å ¥ Ctrl-Z ï¼windowséï¼ï¼æè¾å ¥ Ctrl-D ï¼linuxéï¼ï¼ä½ è¾å ¥çææ代ç å°ä¼ä¸æ¬¡æ§è¡å®æ并è¾åºç»æã
å¨PHP交äºæ¨¡å¼(Interactive mode)éï¼è·äº¤äºå¼shelléä¸ä¸æ ·ï¼ä½ ç代ç éè¦ä»¥ <?IP定位源码php å¼å¤´ï¼è·ä½ çæ®éPHPæ件éçåæ³ä¸è´ãä¸é¢æ¯å¨Windowséç使ç¨ä¾åã
C:\>php -a
Interactive mode enabled
<?php
echo "Hello, world!";
>^Z
Hello, world!
å¨Winidowséï¼æ²¡æ交äºå¼shellï¼åªæInteractive modeã
php å¦ä½è°ç¨.net web service
<?php
$client = new SoapClient('/WebServices/MobileCodeWS.asmx?wsdl');
$parm=array('mobileCode'=>'','userID'=>'');
$result=$client->getMobileCodeInfo($parm);
echo ($result->getMobileCodeInfoResult);
>æµè¯éè¿