我正在使用 WooCommerce 订阅插件,并且尝试获取给定 wc_subscription 的客户或用户 ID。
这是我一直在使用但失败的代码:
add_action( 'woocommerce_scheduled_subscription_trial_end', 'registration_trial_expired', 100 );
function registration_trial_expired( $wc_subscription ) {
mail("example@gmail.com", "Expired", "Someone's order has expired");
$userid = $wc_subscription->customer_user;
mail("example@gmail.com", "Expired", "Someone's order has expired with customer".$userid);
...
}
Run Code Online (Sandbox Code Playgroud)
我以为$wc_subscription->customer_user会有用户 ID,但它是空的。实际上阻止了代码继续。
我怎样才能获得用户ID $wc_subscription?
php wordpress subscription woocommerce woocommerce-subscriptions
有什么方法可以将字符串转换为php中的DOMElement(而不是DOMDocument),以便可以将其导入DOMDocumment?例如,具有HTML字符串:
<div><div>Add Example</div><div>View more examples</div></div>
Run Code Online (Sandbox Code Playgroud)
我想像使用DOMDocument :: createElement来创建它一样。然后,我想将其附加到DOMDocumment的子级中。
我正在使用 bootstrap-table 插件在 HTML 表中显示来自服务器的数据,但我无法让它工作。这是插件网址: http: //bootstrap-table.wenzhixin.net.cn/
这是我的代码:
<table data-url="http://wenzhixin.net.cn/examples/bootstrap_table/data" data-pagination="true" data-page-list="[5, 10, 20, 50, 100, 200]" data-search="true" data-toggle="table" id="table">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-field="id" data-align="right" data-sortable="true">Item ID</th>
<th data-field="name" data-align="center" data-sortable="true">Item Name</th>
<th data-field="price" data-sortable="true">Item Price</th>
</tr>
</thead>
</table>
Run Code Online (Sandbox Code Playgroud)
我已经加载了所有必需的文件,但这不起作用。
这是小提琴: http: //jsfiddle.net/qoyho5jg/