在 SimplePie (PHP) 中创建并包含变量

发布于 2024-08-16 17:23:15 字数 248 浏览 4 评论 0原文

在下面的代码中,如何将 VAR 设置为某个变量,然后将其作为提要 URL 包含在 SimplePie 代码中? “feed”代码来自 Simplepie PHP 库。

<?php

$VAR = "http://website.com/feed/";

$feed1 = new SimplePie();
$feed1->set_feed_url('$VAR'); 
$feed1->init();

?>

Within the code below, how do I set VAR as some variable and then include it within the SimplePie code as the feed URL? The "feed" code is from the Simplepie PHP libary.

<?php

$VAR = "http://website.com/feed/";

$feed1 = new SimplePie();
$feed1->set_feed_url('$VAR'); 
$feed1->init();

?>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝梦月影 2024-08-23 17:23:15

我不确定简单馅饼。但如果您使用单引号,它将不会被处理。尝试使用双引号或更好,您不需要任何引号。
试试这个:

$feed1->set_feed_url($VAR); 

I m not sure about Simple Pie. But if you use single quotes it wont be processed. Try double quotes or better you dont need any quotes for that.
Try this :

$feed1->set_feed_url($VAR); 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文