Can I include a PHP file in an SHTML file and store the result in a SHTML variable?

前端 未结 4 663
暖寄归人
暖寄归人 2021-01-26 04:12

I want to include a PHP file in an SHTML file and store the result in a SHTML variable and include different things depending on the result.

Example:
Assume the PHP

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-26 04:29

    The way to execute PHP on a .shtml page is to modify your .htaccess file. This file may be hidden, so depending upon your FTP program you may have to modify some settings to see it. Then you just need to add this line for .shtml:

    AddType application/x-httpd-php .shtml
    

    If you only plan on including the PHP on one page, it is better to setup this way:

    
    AddType application/x-httpd-php .shtml
    
    

    This code will only make the PHP executable on the yourpage.shtml file, and not on all of your shtml pages.

提交回复
热议问题