我不明白为什么它会显示此消息:“解析错误:C:\wamp\www\aaa\tftp scripts\testTFTP_r3.php 第 45 行解析错误“
每次我尝试执行如下 php 脚本时:
<?
//telnet
require_once "PHPTelnet_config.php";
$telnet = new PHPTelnet();
$result = $telnet->Connect('192.168.100.30','','');
if ($result == 0) {
//echo $username1;
$telnet->DoCommand($username1, $result);
// NOTE: $result may contain newlines
//echo $result;
$telnet->DoCommand($password1, $result);
// NOTE: $result may contain newlines
//echo $result;
// say Disconnect(0); to break the connection without explicitly logging out
//$telnet->Disconnect();
$telnet->DoCommand("super", $result);
$telnet->DoCommand("super", $result);
$telnet->DoCommand("enable", $result);
$telnet->DoCommand("cisco", $result);
$telnet->DoCommand("copy tftp startup-config", $result);
$telnet->DoCommand("192.168.100.99", $result);
}
//here is the command to specify which lab
switch(3){
case 1:
$telnet->DoCommand("R3_lab1_Config", $result);
break;
case 2:
$telnet->DoCommand("R3_lab2_Config_PPP", $result);
break;
case 3:
$telnet->DoCommand("R3_lab3_Config_SSH_NTP_Syslog", $result);
break;
default :
echo "something went wrong with the selections" ;
break;
}
?>
请协助。提前谢谢
答案1
尝试删除默认选项中的 break 语句。