我有一个textarea支持Markdown,我想显示一个占位符来显示Markdown喜欢的格式,但是在文本中放置<br />占位符<br />.如果可能的话,我希望它能创建一个新的线.
我使用的是Rails 3,下面是我正在使用的代码:
<%= f.text_area :info, :placeholder => "if you want you can <br /> add a link by doing this: [text](http://link.com) it's pretty neat aye? or you could use bold by doing this: **bold text is cool**" %>
我正在尝试将我站点上的textarea中的文本添加到MySQL数据库中.
下面是将文本添加到数据库的PHP代码.
if (isset($_POST['text']))
{
$text = sanitizeString($_POST['text']);
$text = preg_replace('/\s\s+/', ' ', $text);
$query = "SELECT * FROM profiles WHERE user='$user'";
if (mysql_num_rows(queryMysql($query)))
{
queryMysql("UPDATE profiles SET text='$text' where user='$user'");
}
else
{
$query = "INSERT INTO profiles VALUES('$user', '$text')";
queryMysql($query);
}
}
else
{
$query = "SELECT * FROM profiles WHERE user='$user'";
$result = queryMysql($query);
if (mysql_num_rows($result))
{
$row = mysql_fetch_row($result);
$text = stripslashes($row[1]);
}
else $text = "";
}
$text = stripslashes(preg_replace('/\s\s+/', ' ', $text));
Run Code Online (Sandbox Code Playgroud)
以下是表单的代码.
<textarea …Run Code Online (Sandbox Code Playgroud) 这是我的虾代码
table1 = [["Time duration selected", "Driving Time", "Stop Time", "Productivity", "Stop Count", "Max Speed (km/h)", "Average Speed (km/h)", "Distance Travelled (km)"]]
table(table1)
Run Code Online (Sandbox Code Playgroud)
这段代码创建了一行..但我需要在这里指定列宽...那么如何设置列宽?
我目前正在创建一个使用Ruby on Rails创建的仪表板应用程序.
我为Ping添加了一个服务器模型和控制器.
我想要的是ping在给定的服务器IP地址上运行命令.
我该如何处理并将结果(状态和M/S)记录到数据库中?
我也想知道如何每分钟运行命令.