小编Ami*_*ino的帖子

未知的修饰符'g'PHP正则表达式错误

我的模式是:/(productimages\/)(\w*)(\/v\/)(\w*)(.jpg)/g 和数据:http://gskinner.com/RegExr/?2ujor

和PHP代码:

$regexp = ' /(productimages\/)(\w*)(\/v\/)(\w*)(.jpg)/g';
if(preg_match("$regexp", $input, $matches, PREG_SET_ORDER)) { 
for($i=0;$i<14;$i++){
echo '--->'.$i.'-->'.$matches[0][$i];

}}
Run Code Online (Sandbox Code Playgroud)

结果:警告:preg_match()[function.preg-match]:未知修饰符'g'

$regexp = ' /(productimages\/)(\w*)(\/v\/)(\w*)(.jpg)/g';
if(preg_match_all("$regexp", $input, $matches, PREG_SET_ORDER)) { 
for($i=0;$i<14;$i++){
echo '--->'.$i.'-->'.$matches[0][$i];

}}
Run Code Online (Sandbox Code Playgroud)

结果:警告:preg_match_all()[function.preg-match-all]:未知修饰符'g'

这个解决方案没有用!:| 在PHP中使用preg_match时,"...中的未知修饰符'g'?

我该怎么办?

php regex

3
推荐指数
1
解决办法
4936
查看次数

WooCommerce - 用户在一段时间内完成状态订单

我需要在上个月通过Woocommerce中的USER ID获得用户完成的购买.

用户有级别(金牌,银牌):

  • 金卡会员每月可以购买4件商品;
  • 银卡会员每月可以购买1件商品.

我需要在将商品添加到购物车之前检查一下.我不想仅为此功能使用插件(无法找到,BTW).

那可能吗?
我怎样才能做到这一点?

谢谢

php wordpress product orders woocommerce

3
推荐指数
1
解决办法
5747
查看次数

关于 Woocommerce 中运输的国家/地区更改 ajax 更新结帐

当客户在结帐页面上更改国家/地区时,我正在寻找一种更新订单审查(运费)的方法。我想使用 jQuery。但是wc_checkout_params wc_checkout_params 已被弃用。

function custom_checkbox_checker() {

    if (is_checkout()) {

        wp_enqueue_script('jquery');
        ?>

        <script type="text/javascript">

            jQuery(document).ready(function (e) {

                var $ = jQuery;

        // wc_checkout_params is required to continue, ensure the object exists

                if (typeof wc_checkout_params === 'undefined')
                    return false;

                var updateTimer,
                        dirtyInput = false,
                        xhr;



                function update_shipping(billingstate, billingcountry) {

                    if (xhr)
                        xhr.abort();

                    $('#order_methods, #order_review').block({message: null, overlayCSS: {background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});

                    var data = {
                        action: 'woocommerce_update_order_review',
                        security: wc_checkout_params.update_order_review_nonce,
                        billing_state: billingstate, …
Run Code Online (Sandbox Code Playgroud)

php ajax jquery checkout woocommerce

1
推荐指数
1
解决办法
9622
查看次数

标签 统计

php ×3

woocommerce ×2

ajax ×1

checkout ×1

jquery ×1

orders ×1

product ×1

regex ×1

wordpress ×1