Home  >  Article  >  Backend Development  >  How to set php abbreviation function

How to set php abbreviation function

藏色散人
藏色散人forward
2019-11-28 13:46:503091browse

Introduction to the usage environment of this tutorial

Server: Ubuntu 18.04 LTS

Database: Mariadb 10.1.34 (Mysql)

Language version: php 7.3

Local side: MacOS High Sierra

Enabling php abbreviations can save some writing, although it is not much different, but if there are more scripts, it will look easier to identify

For example, you need to add php at the beginning of the php script

<?php
    // do..
?>

After turning on the abbreviation, you will not need it

<?
    // do..
?>

And when you want echo information

<?php echo $data; ?>

After turning on the abbreviation

<?=$data;?>

Isn’t it much cleaner!

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

Recommended: PHP tutorial

The above is the detailed content of How to set php abbreviation function. 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