While later. How to assign a value to 1 variables.

Source: Internet
Author: User
While later. How to assign a value to 1 variables.

echo "
      ";
      while ($rs = $result->fetch_assoc ()) {
      echo "
    • ". $rs [' name ']."
    • ";//loop body, loop all articles
      }
      echo "
"




Reply to discussion (solution)

$s = ";
while ($rs = $result->fetch_assoc ()) {
$s. = "

  • ". $rs [' name ']."
  • ";//loop body, loop all articles
    }
    Echo $s;

    That's it. Xuzuning I was surprised. is a variable value.

    I'm assigning this value to a str_ireplace.


    $s =str_ireplace ("<{aaa}>", $aaa, $STR);//replace content


    and then
    fopen ("/muban/muluye.html", "R")//Read template normal.
    $a =fopen ($shengchenglujin, ' w ');//Set the path, print it, the path can read and write.
    Fwrite ($a, $s);//I can't write it in here.

    It's weird, what's going on?

    That's it. Xuzuning I was surprised. is a variable value.

    I'm assigning this value to a str_ireplace.


    $s =str_ireplace ("<{aaa}>", $aaa, $STR);//replace content


    Seek back:

    You echo $s; What do you see?

    $s = ";
    while ($rs = $result->fetch_assoc ()) {
    $s. = "

  • ". $rs [' name ']."
  • ";//loop body, loop all articles
    }
    Echo $s;

    Use is_writable to view and write results.

    You echo $s; What do you see?

    can be displayed normally.
    I am in fwrite ($a, $s), before adding $s = "1111"; he can write normally, as the result of referencing while. cannot be written.

  • 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.