使用php中的函数加载文件

  <?php

function index(){   
    require 'views/meta_info.php';
    require 'views/home.php';
}

index();

    ?>

This is i was trying to do... is this a proper method??

i tried using include also,

  <?php

function index(){   
    include 'views/meta_info.php';
    include 'views/home.php';
}

index();

    ?>

but its not working.. please let me know how to make this work or please tell me any alternate.

You can't use defined variables in include 'views/meta_info.php';include 'views/home.php'; files. Because only valid in index function

and defined variables outside index function cannot use in index function. Because don't have function parameters.