3 回答

TA貢獻(xiàn)1847條經(jīng)驗 獲得超11個贊
使用 str_replace 函數(shù)。
$url =
"https://connectsms.vodafone.com.qa/SMSConnect/SendServlet?application=%username%&password=%password%&content=%message_text%&destination=%gsm%&source=%shortcode%&mask=%mask%";
//define variables
$username = "abcd";
//then
$before = ["%username%","%password%"];
$after = [$username,$password];
$output =
str_replace($before,$after,$url);

TA貢獻(xiàn)1820條經(jīng)驗 獲得超10個贊
獲得 url 后,您可以使用 str_replace() 來放置變量而不是某些字符串。
$new_url = str_replace("%username%" , $username, "http://"."https://connectsms.vodafone.com.qa/SMSConnect/SendServlet?application=%username%&password=%password%&content=%message_text%&destination=%gsm%&source=%shortcode%&mask=%mask%");
https://www.php.net/manual/en/function.str-replace.php

TA貢獻(xiàn)1786條經(jīng)驗 獲得超11個贊
只需替換%username%
而不是<?php echo $username ?>
https://connectsms.vodafone.com.qa/SMSConnect/SendServlet?application=<?php echo $username ?>&password=%password%&content=%message_text%&destination=%gsm%&source=%shortcode%&mask=%mask%
- 3 回答
- 0 關(guān)注
- 275 瀏覽
添加回答
舉報