【发布时间】:2017-07-29 18:23:08
【问题描述】:
我有这段代码,它使用 curl 替换删除图像,它可以正常工作,但我想使用 wordpress 本机函数来完成此操作。
function image( $destination_path, $remote_image_link ) {
$ch = curl_init( $remote_image_link );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
$result = curl_exec( $ch );
if ( $result ) {
$rv = file_put_contents( $destination_path, $result );
}
}
想用wp_remote 或其他一些功能实现相同的功能。任何帮助都会很棒
【问题讨论】:
-
wp_remote_get? -
@smoqadam 是的,如何在这里使用那个
-
@smoqadam 我不知道如何使用上述功能
-
将 3 条卷曲线替换为
$result = wp_remote_get($remote_image_link);