Php 简单html dom解析变量
我有一个大问题,我找不到任何解决办法。我正在使用pyro cms 2.2(codeigniter引擎),我想在blog view.php模板中解析指定的内容。我已经向库中添加了简单的HTMLDOM。使用正常的$url地址没有问题,解析成功。但是如果我替换了url的一部分(比如Php 简单html dom解析变量,php,mysql,codeigniter,simple-html-dom,Php,Mysql,Codeigniter,Simple Html Dom,我有一个大问题,我找不到任何解决办法。我正在使用pyro cms 2.2(codeigniter引擎),我想在blog view.php模板中解析指定的内容。我已经向库中添加了简单的HTMLDOM。使用正常的$url地址没有问题,解析成功。但是如果我替换了url的一部分(比如$url=)http://www.address.com/{{category:country}}};然后系统无法查看我的变量:({{category:country}}。但是如果我用echo打印出来,那么我会看到我的url
$url=)http://www.address.com/{{category:country}}};
然后系统无法查看我的变量:({{category:country}}
。但是如果我用echo打印出来,那么我会看到我的url是正确的,比如address.com/dermany。我也尝试了cURL,但没有改变
昨天我在stackoverflow.com上问了这个问题,但我们没有找到任何解决方案,只是我得到了一个建议,我需要找到一个能够解析字符串的函数。我的问题是:有没有在简单html dom url上使用字符串的解决方案?或者如果没有,那么还有任何其他解决方案可以解析具有特殊字符串支持的html页面(如address.com/{{category:country})
我需要一些关于如何启用解析字符串的帮助,或者关于如何在template.php解析指定url(url地址+mysql数据库中的变量)的其他想法。非常感谢
{{ theme:partial name="aside" }}
{{ post }}
<?php
ini_set("user_agent", "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko)
Chrome/24.0.1312.60 Safari/537.17");
ini_set('display_errors', true);
error_reporting(E_ALL);
$url = 'http://address.com/{{category:country}}';
echo $url;
?>
<article class="single_post">
<h5>{{ theme:image file="link.png" }} {{ title }}<small><a href="{{ base:url }}blog" title="Back to the blog">← Back</a></small></h5>
<div class="post_date">
<span class="date">
{{ theme:image file="date.png" }}
About {{ helper:timespan timestamp=created_on }} ago.
</span>
</div>
<hr>
<div class="post_body">
{{ body }}
</div>
<div class="post_meta">
{{ if keywords }}
{{ theme:image file="tags.png" }}
<span class="tags">
{{ keywords }}
</span>
{{ endif }}
</div>
<?php if (Settings::get('enable_comments')): ?>
<div id="existing-comments">
<h4><?php echo lang('comments:title') ?></h4>
<?php echo $this->comments->display() ?>
</div>
<?php if ($form_display): ?>
<?php echo $this->comments->form() ?>
<?php else: ?>
<?php echo sprintf(lang('blog:disabled_after'), strtolower(lang('global:duration:'.str_replace(' ', '-', $post[0]['comments_enabled'])))) ?>
<?php endif ?>
<?php endif; ?>
</article>
{{ /post }}
{{theme:partial name=“aside”}
{{post}}
{{theme:image file=“date.png”}
关于{{helper:timespan timestamp=created_on}}年前。
{{body}}
{{if关键字}}
{{theme:image file=“tags.png”}
{{关键字}}
{{endif}}
{{/post}
{}
用于HTML中的变量。你不能使用它们生成动态PHP。那么我如何用特殊变量解析网站,你有其他想法吗?如果CI没有一些特定于PHP的方法来获取PHP代码中可访问的模板变量,我会非常惊讶。应该是$url='…'。获取CI变量('category:country')
或其他什么。我没有找到任何其他解决方案