PHP如何自动将PHP文件包含在当前文件夹或子文件夹中

时间:2017-10-12 02:36:26

标签: php

我在文件夹配置上有PHP文件@{ Layout = null; } <html data-ng-app="WebClientModule"> <head title="ASAS"> <title></title> <script src="~/Scripts/angular.min.js"></script> <script src="~/RegistrationScript/MoneyTransfer.js"></script> </head> <body> <table id="tblContainer" data-ng-controller="Web_Client_Controller"> <tr> <td> <div style="color: red;">{{msg}}</div> <table style="border: solid 4px Red; padding: 2px;"> <tr> <td></td> <td> <span>Sender Account No</span> </td> <td> <input type="text" id="sender_account_no" data-ng-model="Sender_Account_No" required="" /> </td> </tr> <tr> <td></td> <td> <span>Serder_Name</span> </td> <td> <input type="text" id="serder_name" required data-ng-model="Serder_Name" require="" /> </td> </tr> <tr> <td></td> <td> <span>Sender_Sort_Code</span> </td> <td> <input type="text" id="sender_sort_code" required data-ng-model="Sender_Sort_Code" require="" /> </td> </tr> <tr> <td></td> <td> <span>Amount_to_Send</span> </td> <td> <input type="text" id="amount_to_send" required data-ng-model="Amount_to_Send" require="" /> </td> </tr> <tr> <td></td> <td> <span>Transcation_Type</span> </td> <td> <input type="text" id="transcation_type" required data-ng-model="Transcation_Type" require="" /> </td> </tr> <tr> <td></td> <td> <span>Date</span> </td> <td> <input type="text" id="date" required data-ng-model="Date" require="" /> </td> </tr> <tr> <td></td> <td> <span>Reciver Account No</span> </td> <td> <input type="text" id="render_account_no" data-ng-model="Reciver_Account_No" required="" /> </td> </tr> <tr> <td></td> <td> <span>Reciver_Name</span> </td> <td> <input type="text" id="reciver_name" required data-ng-model="Reciver_Name" require="" /> </td> </tr> <tr> <td></td> <td> <span>Reciver_Sort_Code</span> </td> <td> <input type="text" id="reciver_sort_code" required data-ng-model="Reciver_Sort_Code" require="" /> </td> </tr> <tr> <td></td> <td> <span>Amount_to_Recived</span> </td> <td> <input type="text" id="amount_to_recive" required data-ng-model="Amount_to_Recive" require="" /> </td> </tr> <tr> <td></td> <td> <span>Transcation_Type</span> </td> <td> <input type="text" id="transcation_type1" required data-ng-model="Transcation_Type1" require="" /> </td> </tr> <tr> <td></td> <td> <span>Date</span> </td> <td> <input type="text" id="date1" required data-ng-model="Date1" require="" /> </td> </tr> <tr> <td></td> <td></td> <td> <input type="button" id="Createuser" value="Submit" data-ng-click="transfer()" /> <input type="button" id="Clear" value="Clear" data-ng-click="Clear()" /> </td> </tr> </table> </td> </tr> </table> </body> </html> <script src="~/RegistrationScript/MoneyTransfer.js"></script>

现在我想将它包含在我的PHP文件中,例如index.php

timezone.php

这工作正常。

现在例如,我有另一个文件夹调用include("config/timezone.php"); 。内部项目有project

然后我在那里加入index.php

如果我这样设置:

timezone.php

当然,它不起作用。

和正确的方法:

include("config/timezone.php");

我的问题:

如何自动设置甚至在子文件夹中包含timezone.php而不手动添加include("../config/timezone.php");

如您所见,我将其设为手动../,添加include("../config/timezone.php");

1 个答案:

答案 0 :(得分:0)

您正在寻找http://php.net/manual/en/function.set-include-path.php吗?

set_include_path( "path/to/config" ) ;