PHP PEAR Validate Package - Fatal Error: Class 'Validate' not found

This is the error I get:

Fatal error: Class 'Validate' not found in C:\xampp\htdocs\final_project\validate.php on line 5

And here is my PHP code:

 <?php
 require_once 'Validate.php';
 foreach($_POST as $name => $value)
 {
 $valid = Validate::string($value);
 }
 ?>

I do not understand what is missing. I installed --alldeps for the validate package, and PEAR include path is also true. Validate_CA does not give me any errors, but it also does not validate.

+1
source share
1 answer

PHP parses include_pathin order of priority. This means that when a relative path is passed in require(), include(), fopen(), file(), readfile()or file_get_contents(), PHP will start searching in the first directory. If the file is found, it includes it. If not, it will continue until the next and repeat the process.

Consider the following path:

include_path = ".:/php/includes:/php/pear"

PHP script:

<?php
require('MyFile.php');

PHP MyFile.php :

  • ./MyFile.php ( )
  • /php/includes/MyFile.php
  • /php/pear/MyFile.php

, Validate.php, Validate.php (, Windows, UNIX) . PHP , PEAR::Validate, PEAR include_path.

- , Validate.php, . , get_include_path(), , .

+2

Source: https://habr.com/ru/post/1762385/


All Articles