考虑到这段代码,两种解决方案似乎都很好。我不明白的是,这两种解决方案有什么区别吗?
general\\u插件。php
function add_custom_query_var( $vars ){
$vars[] = "custom_var";
return $vars;
}
add_filter( \'query_vars\', \'add_custom_query_var\' );
plugin\\u part1。php...
echo \'<a href="https://www.example.com/page/?custom_var=\'.$db_table->db_column.\'">text</a>....\'
...
plugin\\u part1-已修复。php...
echo \'<a href="https://www.example.com/page/\'.add_query_arg( "custom_var", $db_table->db_column).\'">text</a>....\'
...