啊啊啊,为什么会这样!!!
我做一个简单的万年历,做到用表格写星期栏的时候,输出的结果不显示表格,而且显示如下:
我写的代码如下:
echo "<tr style='width:600px;height:30px;margin:0 auto;text-align:center;border:1px solid red;'>"; echo "<td>星期一</td>"; echo "<td>星期二</td>"; echo "<td>星期三</td>"; echo "<td>星期四</td>"; echo "<td>星期五</td>"; echo "<td>星期六</td>"; echo "<td>星期日</td>"; echo "</tr>";
这到底是为什么呢?
回复讨论(解决方案)
没有
浏览器查看源代码里检查一下。
没有
浏览器查看源代码里检查一下。
加了table还是一样
贴出浏览器的源码部分
请帖出完整代码
贴出浏览器的源码部分
请帖出完整代码
这是我的完整代码:
<?php $year=date("Y"); $month=date("n"); //下拉菜单选择年份月份以及当前时间 echo "<div style='margin:0 auto;text-align:center;'>"; echo "<select>"; for($i=1900;$i<2051;$i++) { if($i==$year) { echo "<option selected='selected'>"; echo "$year"; echo "</option>"; } else { echo "<option>"; echo "$i"; echo "</option>"; } } echo "</select>"."年"; echo "<select>"; for($i=1;$i<13;$i++) { if($i==$month) { echo "<option selected='selected'>"; echo "$month"; echo "</option>"; } else { echo "<option>"; echo "$i"; echo "</option>"; } } echo "</select>"."月"; //当前时间的数字时钟 echo "</div>"; echo "<hr style='width:600px;' />"; //星期栏 echo "<table>"; echo '<tr style="width:600px;height:30px;margin:0 auto;text-align:center;border:1px solid red;">'; echo "<td>星期一</td>"; echo "<td>星期二</td>"; echo "<td>星期三</td>"; echo "<td>星期四</td>"; echo "<td>星期五</td>"; echo "<td>星期六</td>"; echo "<td>星期日</td>"; echo "</tr>"; echo "</table>";
下面是浏览器源码:
<div style='margin:0 auto;text-align:center;'><select><option>1900</option><option>1901</option><option>1902</option><option>1903</option><option>1904</option><option>1905</option><option>1906</option><option>1907</option><option>1908</option><option>1909</option><option>1910</option><option>1911</option><option>1912</option><option>1913</option><option>1914</option><option>1915</option><option>1916</option><option>1917</option><option>1918</option><option>1919</option><option>1920</option><option>1921</option><option>1922</option><option>1923</option><option>1924</option><option>1925</option><option>1926</option><option>1927</option><option>1928</option><option>1929</option><option>1930</option><option>1931</option><option>1932</option><option>1933</option><option>1934</option><option>1935</option><option>1936</option><option>1937</option><option>1938</option><option>1939</option><option>1940</option><option>1941</option><option>1942</option><option>1943</option><option>1944</option><option>1945</option><option>1946</option><option>1947</option><option>1948</option><option>1949</option><option>1950</option><option>1951</option><option>1952</option><option>1953</option><option>1954</option><option>1955</option><option>1956</option><option>1957</option><option>1958</option><option>1959</option><option>1960</option><option>1961</option><option>1962</option><option>1963</option><option>1964</option><option>1965</option><option>1966</option><option>1967</option><option>1968</option><option>1969</option><option>1970</option><option>1971</option><option>1972</option><option>1973</option><option>1974</option><option>1975</option><option>1976</option><option>1977</option><option>1978</option><option>1979</option><option>1980</option><option>1981</option><option>1982</option><option>1983</option><option>1984</option><option>1985</option><option>1986</option><option>1987</option><option>1988</option><option>1989</option><option>1990</option><option>1991</option><option>1992</option><option>1993</option><option>1994</option><option>1995</option><option>1996</option><option>1997</option><option>1998</option><option>1999</option><option>2000</option><option>2001</option><option>2002</option><option>2003</option><option>2004</option><option>2005</option><option>2006</option><option>2007</option><option>2008</option><option>2009</option><option>2010</option><option>2011</option><option>2012</option><option>2013</option><option selected='selected'>2014</option><option>2015</option><option>2016</option><option>2017</option><option>2018</option><option>2019</option><option>2020</option><option>2021</option><option>2022</option><option>2023</option><option>2024</option><option>2025</option><option>2026</option><option>2027</option><option>2028</option><option>2029</option><option>2030</option><option>2031</option><option>2032</option><option>2033</option><option>2034</option><option>2035</option><option>2036</option><option>2037</option><option>2038</option><option>2039</option><option>2040</option><option>2041</option><option>2042</option><option>2043</option><option>2044</option><option>2045</option><option>2046</option><option>2047</option><option>2048</option><option>2049</option><option>2050</option></select>年<select><option>1</option><option selected='selected'>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option><option>9</option><option>10</option><option>11</option><option>12</option></select>月</div><hr style='width:600px;' /><table><tr style="width:600px;height:30px;margin:0 auto;text-align:center;border:1px solid red;"><td>星期一</td><td>星期二</td><td>星期三</td><td>星期四</td><td>星期五</td><td>星期六</td><td>星期日</td></tr></table>
贴出浏览器的源码部分
补上完整的浏览器源码:
<div style='margin:0 auto;text-align:center;'><select><option>1900</option><option>1901</option><option>1902</option><option>1903</option><option>1904</option><option>1905</option><option>1906</option><option>1907</option><option>1908</option><option>1909</option><option>1910</option><option>1911</option><option>1912</option><option>1913</option><option>1914</option><option>1915</option><option>1916</option><option>1917</option><option>1918</option><option>1919</option><option>1920</option><option>1921</option><option>1922</option><option>1923</option><option>1924</option><option>1925</option><option>1926</option><option>1927</option><option>1928</option><option>1929</option><option>1930</option><option>1931</option><option>1932</option><option>1933</option><option>1934</option><option>1935</option><option>1936</option><option>1937</option><option>1938</option><option>1939</option><option>1940</option><option>1941</option><option>1942</option><option>1943</option><option>1944</option><option>1945</option><option>1946</option><option>1947</option><option>1948</option><option>1949</option><option>1950</option><option>1951</option><option>1952</option><option>1953</option><option>1954</option><option>1955</option><option>1956</option><option>1957</option><option>1958</option><option>1959</option><option>1960</option><option>1961</option><option>1962</option><option>1963</option><option>1964</option><option>1965</option><option>1966</option><option>1967</option><option>1968</option><option>1969</option><option>1970</option><option>1971</option><option>1972</option><option>1973</option><option>1974</option><option>1975</option><option>1976</option><option>1977</option><option>1978</option><option>1979</option><option>1980</option><option>1981</option><option>1982</option><option>1983</option><option>1984</option><option>1985</option><option>1986</option><option>1987</option><option>1988</option><option>1989</option><option>1990</option><option>1991</option><option>1992</option><option>1993</option><option>1994</option><option>1995</option><option>1996</option><option>1997</option><option>1998</option><option>1999</option><option>2000</option><option>2001</option><option>2002</option><option>2003</option><option>2004</option><option>2005</option><option>2006</option><option>2007</option><option>2008</option><option>2009</option><option>2010</option><option>2011</option><option>2012</option><option>2013</option><option selected='selected'>2014</option><option>2015</option><option>2016</option><option>2017</option><option>2018</option><option>2019</option><option>2020</option><option>2021</option><option>2022</option><option>2023</option><option>2024</option><option>2025</option><option>2026</option><option>2027</option><option>2028</option><option>2029</option><option>2030</option><option>2031</option><option>2032</option><option>2033</option><option>2034</option><option>2035</option><option>2036</option><option>2037</option><option>2038</option><option>2039</option><option>2040</option><option>2041</option><option>2042</option><option>2043</option><option>2044</option><option>2045</option><option>2046</option><option>2047</option><option>2048</option><option>2049</option><option>2050</option></select>年<select><option>1</option><option selected='selected'>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option><option>9</option><option>10</option><option>11</option><option>12</option></select>月</div><hr style='width:600px;' /><table><tr style="width:600px;height:30px;margin:0 auto;text-align:center;border:1px solid red;"><td>星期一</td><td>星期二</td><td>星期三</td><td>星期四</td><td>星期五</td><td>星期六</td><td>星期日</td></tr></table>
不显示表格?表格是显示了,你加个table border="1" 不就可以看到。
至少需要这样
<?php $year=date("Y"); $month=date("n"); //下拉菜单选择年份月份以及当前时间 echo "<div style='margin:0 auto;text-align:center;width:600px;'>"; echo "<select>"; for($i=1900;$i<2051;$i++) { if($i==$year) { echo "<option selected='selected'>"; echo "$year"; echo "</option>"; } else { echo "<option>"; echo "$i"; echo "</option>"; } } echo "</select>"."年"; echo "<select>"; for($i=1;$i<13;$i++) { if($i==$month) { echo "<option selected='selected'>"; echo "$month"; echo "</option>"; } else { echo "<option>"; echo "$i"; echo "</option>"; } } echo "</select>"."月"; //当前时间的数字时钟 echo "<hr />"; //星期栏 echo "<table style='width:100%;'>"; echo '<tr style="height:30px;margin:0 auto;text-align:center;border:1px solid red;">'; echo "<td>星期一</td>"; echo "<td>星期二</td>"; echo "<td>星期三</td>"; echo "<td>星期四</td>"; echo "<td>星期五</td>"; echo "<td>星期六</td>"; echo "<td>星期日</td>"; echo "</tr>"; echo "</table>"; echo "</div>";

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

Laravel simplifies HTTP verb handling in incoming requests, streamlining diverse operation management within your applications. The method() and isMethod() methods efficiently identify and validate request types. This feature is crucial for building

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:
