我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

'../'不在php中工作

I have a file frontend/file.php and I want to include a file (using require function) in database/file2.php (frontend and database folders are in the same directory) I wrote this code:

require('../database/file2.php');

But it isnt working, please help

Use this:

require __DIR__ . '/../database/file2.php';

This will ensure the file is located relative to the current path, read more about this here.

PHP Require Guide

近期文章

  • 通过复选框插入
  • PHP中的控制流程[关闭]
  • 慢PHP登录表单
  • php中的弹出更新[关闭]
  • 获取$ post对象
  • Ajax,jQuery和PHP
  • php中的静态图像
  • Eval代码不起作用
  • php通过循环更新
  • Laravel guzzle http
  • rufus制作系统启动盘时分区类型和格式化选项都是灰色不可选
  • 求助,很简单的C#问题
  • Oracle VM VirtualBox 进行 vim /usr/local/nginx/conf/nginx.conf 配置以后怎么保存退出到如图状态 萌新求助!!!
  • kendoChart 折线图线的名字位置不对
  • 求问,webService接口调用第一次总是失败,之后就成功,为什么??
  • Yeoman和php文件?
  • 传递PHP会话
  • 用树枝分页
  • SSL读取:errno -12192
  • 安全证书

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华