Javascript require_once : Laguage & Control Structures : PHP functions in JavaScript JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » PHP functions in JavaScript » Laguage & Control Structures »

 

Javascript require_once


Example 1

Running
1.require_once('http://www.phpjs.org/js/phpjs/_supporters/pj_test_supportfile_2.js');

Could return
1.true
function require_once(filename) {
    // !No description available for require_once. @php.js developers: Please update the function summary text file.
    // 
    // version: 810.114
    // discuss at: http://phpjs.org/functions/require_once
    // +   original by: Michael White (http://getsprink.com)
    // -    depends on: require
    // *     example 1: require_once('http://www.phpjs.org/js/phpjs/_supporters/pj_test_supportfile_2.js');
    // *     returns 1: true
    var cur_file = {};
    cur_file[window.location.href] = 1;

    // save include state for reference by include_once and require_once()
    if (!window.php_js) window.php_js = {};
    if (!window.php_js.includes) window.php_js.includes = cur_file;
    if (!window.php_js.includes[filename]) {
        if (require(filename)) {
            return true;
        }
    } else {
        return true;
    }
}


HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo PHP functions in JavaScript
» Laguage & Control Structures