Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php is_link

/*
* Surely you can.
* PHP has incredible built-in functionality, which is islink() and readlink(),
* There are many functions like this. See the PHP manul to learn more about it.
*/

/*
* This code is based on Ubuntu Os and applies to other 'Linux distributions' and 'Macs 
* but if you are on Windows read the PHP manual to use this approach.
*
* Server root & Symlink path : /var/www/html/my-project
* Actual path : /home/$(whoami)/my-project
* Path to file I want to add : /home/$(whoami)/my-file
*/
<?php
  
  // Including the file without checking whether the link exists or not.
  include_once(dirname(readlink($_SERVER['DOCUMENT_ROOT'])).'/my-file');

  // including the file after checking if the link exists.
  include_once(dirname(is_link($_SERVER['DOCUMENT_ROOT'])?readlink($_SERVER['DOCUMENT_ROOT']):'alternate-path').'/my-file');

?>
	  
Comment

PREVIOUS NEXT
Code Example
Php :: laravel api error return homepage 
Php :: php code add text on existing pdf file 
Php :: how to use concat in laravel 
Php :: php class 
Php :: install php-mysql 
Php :: iframe site bi link laravel 
Php :: laravel all 
Php :: publish spatie/permission 
Php :: wordpress add query string to url 
Php :: adding two numbers in php 
Php :: how to make primary key and foreign key in phpmyadmin 
Php :: echo foreach 
Php :: php vs python speed 
Php :: woocommerce_product_query 
Php :: connect to ftp server php 
Php :: how to delete database in phpmyadmin 
Php :: how to declare variable in php 
Php :: laravel database backup 
Php :: php strings 
Php :: PHP OOP - Abstract Classes 
Php :: extract in php useful 
Php :: adminlte con laravel 8 
Php :: php .com 
Php :: laravel admin disable batch selection 
Php :: yii2 change transport 
Php :: movies -inurl:(htm|html|php|pls|txt) intitle:index.of “last modified” (mp4|wma|aac|avi) 
Php :: compare in wp 
Php :: wordpress set category front end 
Php :: custom end-point request php-salesforce-rest-api 
Php :: 200usd to php 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =