我想檢查一個變量是否包含*或**,然後我希望它根據找到的內容顯示div。我寫了一個不起作用的腳本。如果變量包含文本,則顯示div
我現在已經改變了它使用PHP和它現在的工作:
<?php
if (strpos($this->element->product_description, '*') !== false) {
echo '<div class="asterisk">
<ul class="asterix">
<li>* Subject to receipt of payment and print ready artwork or sign off of proofs. Large quantities may require a longer lead time.</li>
<li>** Custom sizes can be manufactured to order, longer lead times may apply.</li>
</ul>
</div>';
};
?>
你在哪裏你是例如定義呢?也 –