我期待:Default Values MyValue NEW22! Default Values MyValue NEW!
但是我得到了:Default Values MyValue NEW22! NEW!
谁能告诉我为什么?
代码:
// First call this
function example_callback2( $string2 ) {
$new_value2 = $string2 . " NEW22!";
return $new_value2;
}
add_filter( 'example_filtersubroto', 'example_callback2', 9 );
$value = "Default Values MyValue";
echo $value = apply_filters( 'example_filtersubroto', $value );
// Expected output: Default Values MyValue NEW22! Default Values MyValue NEW!
// Real output: Default Values MyValue NEW22! NEW!
?>
结果:
答案 0 :(得分:1)
想要这样吗?
// First call this
function example_callback2( $string2 ) {
$new_value2 = $string2 . " NEW22!";
$new_value2 .= $new_value2;
return $new_value2;
}
add_filter( 'example_filtersubroto', 'example_callback2', 9 );
$value = "Default Values MyValue";
echo $value = apply_filters( 'example_filtersubroto', $value );