警告:require_once(__ __ DIR / db_connect.php)function.require一次]:未能打开流:没有这样的文件或目录文件、目录、DIR、require_onc

2023-09-07 01:22:39 作者:猪猪女孩

我开发一个Android应用程序,我想为 通过PHP API连接我与PHP数据库应用程序。 ,我使用虚拟主机来运行我的PHP脚本,

但是当我使用下面的code。我得到一个错误是:有没有这样的文件

如果有人能帮助我在这,这将是对我来说是很好的帮助。

 < PHP

   require_once(__ DIR__/db_connect.php');

?>
 

解决方案 浅谈文件包含漏洞

请确保在 DIR 未在单引号('),所以你的code线应该是这样的:

  require_once(__ __ DIR'/ db_connect.php');
 

I am developing an Android app, and i am trying to connect my app with PHP Database through PHP API. And i am using web host to run my PHP scripts,

But when i use following code. i am getting an error that : There is no such file.

if someone can help me in this, it will be a good help for me .

<?php

   require_once(__DIR__ . '/db_connect.php');

?>

解决方案

Make sure the DIR is NOT within apostrophe ('), so your line of code should look like this:

require_once(__DIR__.'/db_connect.php');