如何通过菜单调用我的插件(wordpress)的服务器端文件?

I have a plugin in wordpress that contain 2 php files. In main file , I added two menus and I want to call second php file when user click on second menu. I have a public method that name list_table_page on second file.

add_menu_page( 'tm-plug', 'test.php', 'manage_options', plugins_url( 'tm_plug/test.php' ), 'list_table_page' );

As for as it's cited in WP Code Reference, add_menu_page is defined as:

add_menu_page ( string $page_title, //required 
string $menu_title, //required
string $capability, /required
string $menu_slug, //required
callback $function = '', //optional
string $icon_url = '', //option
int $position = null //option
);

And the example given is:

add_menu_page(
        __( 'Custom Menu Title', 'textdomain' ),
        'custom menu',
        'manage_options',
        'myplugin/myplugin-admin.php',
        '',
        plugins_url( 'myplugin/images/icon.png' ),
        6
    );

Which, looking at your code, you're defining the values and parameters wrong. Have a look at below:

add_menu_page ( 'tm-plug', //string $page_title
'tm-plug', //string $menu_title
'manage_options', //string $capability
'list_table_page', //string $menu_slug
'tm_plug/test.php', //callback $function = ''
'', //string $icon_url = '' (you haven't defined any)
1 //int $position = null(you haven't defined any)
);

Hope by looking at the comments you'd be able to see where you have gone wrong.

include the file at the to using require_once

and then call the function of that file (second file ) in the definition of second menu function .

Let me know if you need more help.