我对if语句有一个问题,我现在已经测试了很多次了。
$user_query = new WP_User_Query( array( \'role\' => \'Subscriber\' ) );
if ( !empty( $user_query->results ) ) {
foreach ( $user_query->results as $user ) {
echo $user->province . \'<br/>\'; // this outputs the province as expected, i.e. Free State
if ($user->province == \'Free State\') { // This does not return true, even though the echo above works
echo \'<strong>\' . $user->company_name . \'</strong> <br/>\';
echo $user->town. \'<br/>\';
echo $user->province. \'<br/>\';
}
} else {
echo \'There are currently no photographers for this region.\';
}
}
我基本上只想向某个省份的摄影师展示。非常感谢。