警告:require_once(__ __ DIR / db_connect.php)function.require一次]:未能打开流:没有这样的文件或目录 [英] Warning: require_once(__DIR__/db_connect.php) [function.require-once]: failed to open stream: No such file or directory

查看:1057
本文介绍了警告:require_once(__ __ DIR / db_connect.php)function.require一次]:未能打开流:没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个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');

这篇关于警告:require_once(__ __ DIR / db_connect.php)function.require一次]:未能打开流:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆