小编Mat*_*son的帖子

Rails:添加列后添加索引

假设我table在Rails应用程序中创建了一个表.一段时间后,我添加一个列运行:

rails generate migration AddUser_idColumnToTable user_id:string. 
Run Code Online (Sandbox Code Playgroud)

然后我意识到我需要添加user_id为索引.我知道这个add_index方法,但是这个方法应该在哪里调用?我应该运行迁移(如果是,哪一个?),然后手动添加此方法?

migration indexing ruby-on-rails

112
推荐指数
4
解决办法
9万
查看次数

PHP Perl - mail/mime.php 无法打开流

我需要一些帮助,如何使用 Perl 发送电子邮件。

当我尝试运行此代码时:

require_once ("Mail.php");
require_once ("Mail/mime.php");

$text = "test";
$html_message = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>....</title>
</head>
<body>
    <p>...</p>
</body>
</html>';

$headers["From"] = 'sample@sampel.com';
$headers["To"] = "sample@sampel.com"; 
$headers["Subject"] = "Sample SMTP PERL";
$headers["Content-Type"] = 'text/html; charset=UTF-8';
$headers["Content-Transfer-Encoding"]= "8bit";

$mime = new Mail_mime; 
$mime->setTXTBody($text); 
$mime->setHTMLBody($html_message); 
$mimeparams=array(); 

// It refused to change to UTF-8 even if the header was set to this, after adding the following lines it worked.

$mimeparams['text_encoding']="8bit"; …
Run Code Online (Sandbox Code Playgroud)

php php-5.5

0
推荐指数
1
解决办法
3180
查看次数

标签 统计

indexing ×1

migration ×1

php ×1

php-5.5 ×1

ruby-on-rails ×1