如何写php require_once` <?php bloginfo('url'); ?> / database.php`

In wordpress <?php bloginfo('url'); ?> is the main page's url, then, how to write a require_once include <?php bloginfo('url'); ?> Something I write like this is not worked :{

<?php require_once ( "".bloginfo('url')."/database.php"); ?>

The bloginfo function will echo the data, not return it. As such, you need to use the get_bloginfo function, as this simply returns the data.

For example:

<?php require_once (get_bloginfo('url') . '/database.php'); ?>

However, it should be noted that if you're trying to include a local file you should simply use the ABSPATH define, as this will return the base install directory, which is what I'm guessing you're attempting to do.

i.e.: If "database.php" is located in the root WordPress directory, then...

<?php require_once (ABSPATH . '/database.php'); ?>

...should work.

Our you could consider using home_url(); home_url

If you are just trying to access wordpress database if so use the global $wpdb variable