我想在插件功能面板中创建功能:WP ALL Import
我有字符串“ product_code” 当我在php函数中放入完整的图像URL并调用它时就可以使用。
https://xxx.xx/slike/0352097_big.jpg
但是现在我需要创建函数并创建URL链接:
echo "https://xxx.xx/slike/"; echo $product_code; echo"_big.jpg";
我尝试建立一些东西,但是没有成功。 具有完整URL功能的PHP。
header("Content-Type: image/jpeg");
if(file_exists("/var/www/vhosts/xxx/httpdocs/import/ca.pem") &&
file_exists("/var/www/vhosts/xxx/httpdocs/import/client.pem") &&
file_exists("/var/www/vhosts/xxx/httpdocs/import/key.pem"))
{
$ch =curl_init();
curl_setopt($ch, CURLOPT_SSLVERSION,3);
curl_setopt($ch, CURLOPT_URL,"?????");
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_CAINFO,
realpath("/var/www/vhosts/xxx/httpdocs/import/ca.pem"));
curl_setopt($ch, CURLOPT_SSLCERT,
realpath("/var/www/vhosts/xxx/httpdocs/import/client.pem"));
curl_setopt($ch, CURLOPT_SSLKEY,
realpath("/var/www/vhosts/xxx/httpdocs/import/key.pem"));
curl_setopt($ch, CURLOPT_SSLKEYPASSWD, "xxxx");
$res = curl_exec($ch);
$rescode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch) ;
echo $res;
}
}
获得URL结构后,我将为wp all import中的每个产品声明$ product_code。
https://xxx.xx/slike/***$product_code***_big.jpg";