Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个代码:
$variable_name = bla bla bla;
我想将此代码添加到此变量:
<a class="screenshot" rel="<?php echo $baseurl.$this->row->image; ?>" > <div class="photo"></div> </a>
有人可以帮忙吗?
谢谢
您将其分配给您的变量,就像任何其他字符串一样。但是,由于您已经处于 php 模式,因此您必须删除<?php ?>,并使用字符串连接运算符.来包含$baseurl.$this->row->image
<?php ?>
.
$baseurl.$this->row->image
$variable_name = '<a class="screenshot" rel="' . $baseurl.$this->row->image . '" > <div class="photo"></div> </a>';