首页 > 解决方案 > 用 CSS 隐藏 PHP 变量

问题描述

在任何地方都找不到答案,我确信它就在那里,但我可以看到它!

我试图通过 CSS(或任何其他方式)隐藏后缀变量。我只是从代码中删除了它,但由于某种原因它破坏了整个网站。

代码是

if (count($redq_product_inventory)) {
    $price_html = '<span class="amount rnb_price_unit_' . $product_id . '"> ' . $prefix . '&nbsp;' . $range . '&nbsp;' . $suffix . '</span>';
    update_post_meta($product_id, '_price', $price);
} else {
    $price_html = sprintf(__('You don\'t have any inventory with this product. This product in not bookable.', 'redq-rental'));
} 

谢谢!

标签: phphtmlcsswordpress

解决方案


从该 PHP 代码中删除变量不应破坏该站点。当你删除它时,也许只是有一些小错误。该代码行应该是:

$price_html = '<span class="amount rnb_price_unit_' . $product_id . '"> ' . $prefix . '&nbsp;' . $range . '</span>';

(我想你不需要最后一个用于andnbsp;之间的空间,所以我也删除了它。)$range$suffix


推荐阅读