Find a php code that calls txt data and assigns values

Source: Internet
Author: User
Ask Phpto call the txt file data and assign the value to the code first page file  index.html Reference File:./txt/pan.txt in the third row: the value in the third row of the cursor; how should I write this php? Find a php code that calls txt file data and assigns values
Homepage file index.html
Reference File: The third line in./txt/pan.txt: false or yes
Make an if.elsesentence in index.html. the variable dovalue is the value in the third row of pan.txt;

How should I write this php?
Reference variable reference txt if... else judgment statement share:
------ Solution --------------------
 $ MyFile = "./txt/pan.txt ";
$ Lines = file ($ myFile); // put the file into the array
$ Do = $ lines [3]; // line 3

If ($ do = "false "){
Echo "false, do..."; // false
} Elseif ($ do = "yes "){
Echo "yes, do..."; // yes
} Else {
Echo "not supported"; // Other values
}
?>

------ Solution --------------------
Wrong. line 4.
 $ MyFile = "./txt/pan.txt ";
$ Lines = file ($ myFile); // put the file into the array
$ Do = $ lines [2]; // line 3
 
If ($ do = "false "){
Echo "false, do..."; // false
} Elseif ($ do = "yes "){
Echo "yes, do..."; // yes
} Else {
Echo "not supported"; // Other values
}
?>

Reference:
   $ MyFile = "./txt/pan.txt ";
$ Lines = file ($ myFile); // put the file into the array
$ Do = $ lines [3]; // line 3

If ($ do = "false "){
Echo "false, do..."; // false
} Elseif ($ do = "yes "){
Echo "yes, do..."; // yes
} Else {
Echo "not supported"; // Other values
}
?>

------ Solution --------------------
What is your template language?

If the knowledge output is correct, you can modify it and directly echo"
    "Okay. if it is false, no processing is performed. if it is false, no judgment is required to determine whether it is yes.

    Reference:
    In fact, the output is
      If the do value is yes, it will be output. if it is false, it will not be output. how can this problem be achieved?
           
          


        {query:name=commend_goods as co join=left join goods as go on co.goods_id eq go.id where=co.commend_id eq 1 and go.is_del eq 0 AND go.id is not null fields=go.list_img,go.sell_price,go.name,go.market_price,go.id limit=7 order=id desc group = id}
        {set:$tmpId=$item['id'];}

      •     
            
             
                             
             {$item['name']}
             

        RMB{$item['sell_price']}



      • {/query}




      Quote: reference:

      Wrong. line 4.
             $ MyFile = "./txt/pan.txt ";
      $ Lines = file ($ myFile); // put the file into the array
      $ Do = $ lines [2]; // line 3
       
      If ($ do = "false "){
      Echo "false, do..."; // false
      } Elseif ($ do = "yes "){
      Echo "yes, do..."; // yes
      } Else {
      Echo "not supported"; // Other values
      }
      ?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.