两次str_replace

时间:2017-03-18 21:20:10

标签: php api

我真的很想解决这个问题。 如何在命令行中使用str_replace两次来创建这样的东西:

  

/ send_message user_id message

注意:
$text =(命令行中的文字)
$to_id =(用户ID)
$to_text =(消息)

$to_id = str_replace("/st ","",$text);
$to_text = str_replace("/st $to_id ","",$text);
if ($text == "/st $to_id $to_text") {
        apiRequest("sendMessage", array('chat_id' => $to_id ,"text" => "$to_text"));
}

1 个答案:

答案 0 :(得分:1)

您正在尝试提取user_id和消息,对吗?使用explode拆分空格字符串。

function getdata_user($email)
{
    $query= $this->db->get_where("users", array("email"=>$email));

    return $query->result();

}
相关问题