我正在设计一个电报机器人。我想展示一些链接,例如
1- wkpviana
2- vianahosting
当用户点击它时,打开
<?php
...
$sLink = "";
foreach($Links as $Row){
$sLink .= "<a href='".$Row->link_url."'>".$Row->link_name."</a>";
}
$Text = $sLink;
...
$URL = "https://api.telegram.org/bot".$Token."/sendMessage?chat_id=".$ChatID."&text=".$Text."&reply_markup=".json_encode($KB);
file_get_contents($URL);
?>
在浏览器中。 我怎么能在PHP中创建它? 我的部分代码是:
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch: AnyObject in touches {
let pointOfTouch = touch.location(in: self)
let nodeUserTapped = atPoint(pointOfTouch)
if nodeUserTapped.name == "PauseButton" {
if (self.isPaused == false) {
pauseGame()
}
}
if nodeUserTapped.name == "ResumeButton" {
if (self.isPaused == true) {
resumeGame()
}
}
}
}
// MARK: - pauseGame
func pauseGame() {
self.isPaused = true
currentGameState = gameState.pauseGame
self.physicsWorld.speed = 0
self.speed = 0.0
if (backgroundMusicIsOn == true) {
backingAudio.stop()
}
if resumeButton.isHidden == true {
resumeButton.isHidden = false
}
if pauseButton.isHidden == false {
pauseButton.isHidden = true
}
}
// MARK: - resumeGame
func resumeGame() {
self.isPaused = false
currentGameState = gameState.inGame
self.physicsWorld.speed = 1
self.speed = 1.0
if (backgroundMusicIsOn == true) {
backingAudio.play()
}
if resumeButton.isHidden == false {
resumeButton.isHidden = true
}
if pauseButton.isHidden == true {
pauseButton.isHidden = false
}
}
答案 0 :(得分:4)
您似乎尝试使用<a>
代码发送链接,该代码工作正常,但要求您使用parse_mode=html
参数,如文档所述here.
我相信它看起来有点像这样:
$URL = "https://api.telegram.org/bot".$Token."/sendMessage?chat_id=".$ChatID."&text=".$Text."&parse_mode=HTML&reply_markup=".json_encode($KB);