Jump to content

Class not found when using require


ukweb

Recommended Posts

Hi

 

This is a strange one, and I'm not sure whats going on here. I've tried googling the answer to no avail.

 

Basically, I'm writing a Wordpress plugin, and here's my setup:

 

install.php has a class called 'two_install'

 

The main plugin file code snippet:

 

// Installation
require(plugin_basename('installer.php'));

// Initiate installation class
$twp_install = new twp_install;

 

This results in this on activation:

 

Fatal error: Class 'twp_install' not found in path-on-server\wp-content\plugins\twitter_parser\twitter_parser.php on line xx

 

Anyone got any ideas? Just a note, there is definitely a class called 'twp_install' in installer.php!

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/261632-class-not-found-when-using-require/
Share on other sites

I can think of at least 6 different things that would prevent a class definition from being seen in a file.

 

If you want someone here to help determine why, you would need to post your installer.php file, showing the opening php tag through to the start of that class definition, especially since you implied two different spellings for the class name in your post.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.