【问题标题】:php sms code errorphp短信代码错误
【发布时间】:2013-04-07 14:25:38
【问题描述】:

在确认我们的手机号码中发布短信警报后,我正在尝试使用 php 编码注册我们的产品 ....在使用 way2 短信移动网站..似乎发生了一些错误 ....

消息已发送到您的电子邮件地址正在登录... 注意:未定义的偏移量:第 126 行 C:\wamp\www\html\class.sms.php 中的 1 发送短信... 注意:未定义的偏移量:第 147 行 C:\wamp\www\html\class.sms.php 中的 1 遇到错误:

class.sms.php :


preg_match($pattern,$out,$matches);
        $id=trim($matches[1]);     // 126 line
        $this->data['id']=$id;

    }

    private function send_160by2($number,$msg)
    {
        $msg=urlencode($msg);
        $id=$this->data['id'];
        $out1=$this->curl->post("http://m.160by2.com/...Compose.asp?l=1","txt_mobileno=$number&txt_msg=$msg&cmdSend=Send+SMS&TID=&T_MsgId=&Msg=$id");
        //echo $out1;
        $pattern = '/\<table.+?\>(.+)\<\/table/s';
        preg_match($pattern, $out1, $matches);

        $out=strip_tags(@$matches[1]);
        if(count($matches)<1)
        {
        $pattern="/\<div.+?background:.+?yellow.+?\>(.+?)\<\/div\>/s";

        preg_match($pattern,$out1,$matches);

        $out=strip_tags($matches[1]);           // 147 line 
        }

【问题讨论】:

    标签: php cakephp


    【解决方案1】:

    消息对我来说很清楚:$matches[1] 在位置 1 处没有元素。 尝试像这样打印你的$matches 数组,你会看到你有什么:

    preg_match($pattern,$out,$matches);
    print_r($matches);
    

    您的 RegEx 似乎没有返回任何结果 $matches

    【讨论】:

    • 哥们我导致一个错误:注意:未定义的偏移量:C:\wamp\www\html\class.sms.php 中的 1 在第 126 行发送 SMS ... Array () 遇到错误:
    • 看起来您的$pattern 在您的$out 字符串中找不到任何$matches。可以打印出来贴在评论里吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多