Home >Backend Development >PHP Tutorial >How to set and enable php abbreviation (php.ini, short_open_tag) in php

How to set and enable php abbreviation (php.ini, short_open_tag) in php

藏色散人
藏色散人forward
2020-09-05 09:13:443011browse

How to set and enable php abbreviation (php.ini, short_open_tag) in php

Recommended: "PHP Video Tutorial"

php Set to enable php abbreviation (php.ini, short_open_tag)

Introduction to the usage environment of this tutorial

伺服器端:Ubuntu 18.04 LTS
资料库:Mariadb 10.1.34(Mysql)
语言版本:php 7.3
本机端:MacOS High Sierra

Enabling php abbreviations can save some writing. Although it is not much different, it is just that if there are too many scripts, it will look easier to identify

For example, php scripts need to be added at the beginning On php

<?php
    // do..
?>

After turning on the abbreviation, you don’t need it

<?
    // do..
?>

And when you want echo information

<?php echo $data; ?>

After turning on the abbreviation

<?=$data;?>

, is it much cleaner? It’s over!

There may be other abbreviations, but I didn't find them~

Just note that if you use crontab to run a php script, the script still needs to have

Then start setting the abbreviation function

Go to the php version you are currently using, there will be an apache2 folder inside

Go directly to nano and enter php.ini

$ nano /etc/php/7.X/apache2/php.ini

Then find short_open_tag and change it to On

short_open_tag = On

Don’t forget to reload

$ service apache2 reload

The above is the detailed content of How to set and enable php abbreviation (php.ini, short_open_tag) in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete