Predefined Constants

The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.

DIRECTORY_SEPARATOR (string)
PATH_SEPARATOR (string)
Available since PHP 4.3.0. Semicolon on Windows, colon otherwise.
SCANDIR_SORT_ASCENDING (integer)
Available since PHP 5.4.0.
SCANDIR_SORT_DESCENDING (integer)
Available since PHP 5.4.0.
SCANDIR_SORT_NONE (integer)
Available since PHP 5.4.0.

Коментарии

Автор:
For my part I'll continue to use this constant because it seems more future safe and flexible, even if Windows installations currently convert the paths magically. Not that syntax aesthetics matter but I think it can be made to look attractive:

<?php
$path 
join(DIRECTORY_SEPARATOR, array('root''lib''file.php');
?>
2013-09-29 19:09:27
http://php5.kiev.ua/manual/ru/dir.constants.html
Автор:
In PHP 5.6 you can make a variadic function.

<?php
/**
 * Builds a file path with the appropriate directory separator.
 * @param string $segments,... unlimited number of path segments
 * @return string Path
 */
function file_build_path(...$segments) {
    return 
join(DIRECTORY_SEPARATOR$segments);
}

file_build_path("home""alice""Documents""example.txt");
?>

In earlier PHP versions you can use func_get_args.

<?php
function file_build_path() {
    return 
join(DIRECTORY_SEPARATORfunc_get_args($segments));
}

file_build_path("home""alice""Documents""example.txt");
?>
2014-03-08 17:04:32
http://php5.kiev.ua/manual/ru/dir.constants.html
Автор:
<?php
class RegisterController extends Controller{
   
/*
    |--------------------------------------------------------------------------
    | Register Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users as well as their
    | validation and creation. By default this controller uses a trait to
    | provide this functionality without requiring any additional code.
    |
    */

   
use RegistersUsers;

   
/**
     * Where to redirect users after registration.
     *
     * @var string
     */
   
protected $redirectTo '/home';

   
/**
     * Create a new controller instance.
     *
     * @return void
     */
   
public function __construct()
    {
       
$this->middleware('guest');
    }

   
/**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
   
protected function validator(array $data)
    {
        return 
Validator::make($data, [
           
'name' => 'required|string|max:255',
           
'email' => 'required|string|email|max:255|unique:users',
           
'password' => 'required|string|min:6|confirmed',
        ]);
    }

   
/**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return \App\User
     */
   
protected function create(array $data)
    {
        return 
User::create([
           
'name' => $data['name'],
           
'email' => $data['email'],
           
'password' => bcrypt($data['password']),
        ]);
    }
}
?>

Result:

Success
2019-05-07 21:21:12
http://php5.kiev.ua/manual/ru/dir.constants.html

    Поддержать сайт на родительском проекте КГБ