1、sprintf
$hiddenImgInputFormat = '<input type="hidden" name="EbayListing[child_sku_img][%s][%s][%s][]" value="%s"/>';
$hiddenImageInput .= sprintf($hiddenImgInputFormat ,$siteid, $account_id, $child['sku'], $img);
2、strtr : 转换指定字符
string strtr ( string $str , string $from , string $to )
string strtr ( string $str , array $replace_pairs )
$describe = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$newStr = [
'$Title$' => $attributes['sell_title'],
'$sell_sub_title$' => $attributes['sell_sub_title'],
'$PT$' => $attributes['five_name'], //五要点
'$KeyWord$' => $attributes['keyword'],
'$Describe$' => strpos($describe, '$Describe$')===false ? '' : 'xx',
'$Image$' => strpos($describe, '$Image$')===false ? '' : 'xxx'
];
$describe = strtr($describe, $newStr);
980

被折叠的 条评论
为什么被折叠?



