Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8056781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:49:27+00:00 2026-06-05T08:49:27+00:00

I have a file with a class Resp . The path is: C:\xampp\htdocs\One\Classes\Resp.php And

  • 0

I have a file with a class Resp. The path is:

C:\xampp\htdocs\One\Classes\Resp.php

And I have an index.php file in this directory:

C:\xampp\htdocs\Two\Http\index.php

In this index.php file I want to instantiate a class Resp.

$a = new Resp();

I know I can use require or include keywords to include the file with a class:

require("One\Classes\Resp.php");       // I've set the include_path correctly already ";C:\xampp\htdocs". It works.
$a = new Resp();

But I want to import classes without using require or include. I’m trying to understand how use keyword works. I tried theses steps but nothing works:

use One\Classes\Resp;
use xampp\htdocs\One\Classes\Resp;
use htdocs\One\Classes\Resp;
use One\Classes;
use htdocs\One\Classes;    /* nothing works */

$a = new Resp();

It says:

Fatal error: Class 'One\Classes\Resp' not found in C:\xampp\htdocs\Two\Http\index.php

How does the keyword use work? Can I use it to import classes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T08:49:29+00:00Added an answer on June 5, 2026 at 8:49 am

    use doesn’t include anything. It just imports the specified namespace (or class) to the current scope

    If you want the classes to be autoloaded – read about autoloading

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have file index.php , and I want to include file class.twitter.php inside it.
Need some help with inclusion of outside variables. I have this file lang.class.php class
I have a file attachment class (FileAttachment) which is used in several other classes.
We have a class Car defined like this in a car.rb file class Car
I have the following classes in my models file class HardwareNode(models.Model): ip_address = models.CharField(max_length=15)
I have a file in .gz format. The java class for reading this file
i have a really basic java program just one .java/.class file (.java uncompiled .class
I have php file with a class in it that needs to read a
I have a 3 file: class.database.php config.php test.php In class.database.php i using: <?php class
Here is my problem. I have one file (say, func.inc.php) with autoloader function, registered

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.