• February 14, 2023

    why i can’t include php file in the same site : include(‘https://www.cymiz.com/bla-q/99.20-core.php’);

    You can’t include a PHP file from a different website using a URL as an argument in the include function. This is because including files from external websites can be a security risk and can also cause performance issues. Instead, you should include the file using a relative or absolute path on your own website.

    willson markkes

    yes , internal website ,please ex

    If you want to include a PHP file in the same website, you can use a relative or absolute file path instead of a URL. Here are examples of how to do that:

    1. Relative path: If the file you want to include is located in the same directory as the script that is including it, you can use a relative path like this:
    phpCopy codeinclude('file-to-include.php');
    

    If the file is located in a subdirectory, you can use a relative path that includes the subdirectory name:

    phpCopy codeinclude('subdirectory/file-to-include.php');
    
    1. Absolute path: If you want to use an absolute path, you can use the $_SERVER[‘DOCUMENT_ROOT’] variable to get the path to the root directory of your website, and then append the rest of the path to the file you want to include. For example:
    cssCopy codeinclude($_SERVER['DOCUMENT_ROOT'] . '/path/to/file/file-to-include.php');
    

    This will include the file located in the “file” subdirectory of the “path/to” directory, relative to the root directory of your website.

    willson markkes

    why this is not work : include($_SERVER[‘DOCUMENT_ROOT’] . ‘https://www.cymiz.com/bla-q/99.20-core.php’);

    The reason why it’s not working is because you are trying to include a PHP file from a different website using a URL. When you use $_SERVER['DOCUMENT_ROOT'], it gives you the absolute path to the root directory of your own website, but you can only include files that are located on your own server.

    To include a file from your own website using $_SERVER['DOCUMENT_ROOT'], you would use a path that is relative to your website’s root directory, like this:

    cssCopy codeinclude($_SERVER['DOCUMENT_ROOT'] . '/path/to/file/file-to-include.php');
    

    To include a file from a different directory on your own server, you would use a path that is relative to the directory where the script that is including the file is located, like this:

    cssCopy codeinclude('path/to/file/file-to-include.php');
    

    To include a file from a different website, you would need to use a URL like you did in your original example. However, as I mentioned earlier, including files from external websites can be a security risk and can cause performance issues, so it’s generally not recommended.

    willson markkes

    if cymiz.com is my web site , how can i include if my locate file in this path https://www.cymiz.com/bla-q/99.20-core.php

    If https://www.cymiz.com/bla-q/99.20-core.php is located on your own website, you can include it using a relative path like this:

    phpCopy codeinclude('bla-q/99.20-core.php');
    

    This assumes that the file 99.20-core.php is located in the bla-q directory relative to the directory where the script that is including the file is located.

    If the file is located in a directory that is not in the same directory as the script that is including it, you can use a relative path that includes the subdirectory name like this:

    phpCopy codeinclude('path/to/file/99.20-core.php');
    

    This assumes that the file 99.20-core.php is located in the file directory relative to the directory where the script that is including the file is located.

    Alternatively, you can use an absolute path like this:

    phpCopy codeinclude($_SERVER['DOCUMENT_ROOT'] . '/bla-q/99.20-core.php');
    

    This assumes that the file 99.20-core.php is located in the bla-q directory relative to the root directory of your website.



เวอไนน์ไอคอร์ส

ประหยัดเวลากว่า 100 เท่า!






เวอไนน์เว็บไซต์⚡️
สร้างเว็บไซต์ ดูแลเว็บไซต์

Categories


Uncategorized