我很难在我的服务器上安装phantomjs.我没有在任何地方找到非常好的方向,当我尝试完成它们时,我发现的最好的错误给我错误.截至目前,我正在遵循这些步骤并获得这些错误.
成功使用putty以root身份登录并运行以下命令
Line 1: yum install fontconfig freetype freetype-devel fontconfig-devel libstdc++
No errors
Line 2: wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
No errors
Line 3: mkdir -p /opt/phantomjs
No errors
Line 4: tar -xjvf ~/phantomjs-1.9.8-linux-x86_64.tar.bz2 --strip-components 1 /opt/phantomjs/
Error: opt/phantomjs: Not found in archive
Run Code Online (Sandbox Code Playgroud)
对于这个错误(第4行)我ftp进入我的服务器,没有看到任何目录的opt/phantomjs.我创建了一个但是在"存档中找不到"错误.
在此之后,我发现的唯一其他代码行应该是:
Line 5: ln -s /opt/phantomjs/bin/phantomjs /usr/bin/phantomjs
Line 6: phantomjs /opt/phantomjs/examples/hello.js
Run Code Online (Sandbox Code Playgroud)
如果有人有任何见解我会非常感激!
我正在使用下面的 woocommerce 操作来调用自定义函数,但由于某种原因,它在每个订单上都会被触发两次。有谁知道这可能是为什么或如何解决它以便每个订单只调用一次?
add_action( 'woocommerce_thankyou', 'parent_referral_for_all', 10, 1 );
function parent_referral_for_all( $order_id ) {
....
}
Run Code Online (Sandbox Code Playgroud)
更新
我以为这个动作被触发了两次,但我现在不太确定。我正在使用此操作在affiliatewp 插件中添加另一个推荐,该插件添加了两次,但我对“谢谢”的回声只出现一次。
一切都按预期工作,只是推荐(及其相关的订单说明)被添加了两次。
任何帮助将不胜感激。
那个完整的功能:
function parent_referral_for_all( $order_id ) {
//Direct referral
$existing = affiliate_wp()->referrals->get_by( 'reference', $order_id );
$affiliate_id = $existing->affiliate_id;
//Total amount
if( ! empty( $existing->products ) ) {
$productsarr = maybe_unserialize( maybe_unserialize( $existing->products ) );
foreach( $productsarr as $productarr ) {
$bigamount = $productarr['price'];
}
}
//Parent amount
$parentamount = $bigamount * .1;
$affiliate_id = $existing->affiliate_id;
$user_info = get_userdata( affwp_get_affiliate_user_id( $existing->affiliate_id …Run Code Online (Sandbox Code Playgroud) 我已经尝试使用不同的 Java 格式化程序进行各种不同的转换,但我仍然对看似简单的东西没有任何运气。
我有一个字符串,它是 UTC 格式的日期/时间。我正在尝试将其转换为另一个时区。有人能告诉我为什么下面的方法不起作用吗?时区正在改变,但改变的方式不正确。
更新:(虽然我似乎没有正确地将时区设置为 UTC,因为转换也不正确)。
String dateInput = "2021-02-16 20:57:43";
SimpleDateFormat mdyUtc = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss");
mdyUtc.setTimeZone(TimeZone.getTimeZone("UTC");
Date utcOutput = mdyUtc.parse(dateInput);
SimpleDateFormat mdyOffset = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss");
mdyOffset.setTimeZone(TimeZone.getTimeZone("GMT-10:00");
Date localOutput = mdyOffset.parse(dateInput);
System.out.print("UTC date = " + utcOutput);
System.out.print("Changed date = " + localOutput);
Run Code Online (Sandbox Code Playgroud)
输出:
UTC 日期 = 2021 年美国东部时间 2 月 16 日星期二 15:57:43
更改日期 = 2021 年东部标准时间 2 月 17 日星期三 01:57:43