Laravel 5土耳其人角色问题

时间:2017-02-10 18:04:54

标签: php laravel laravel-5

我是Laravel的新手,我正试图通过开发一个网站来加入。我有我的onw cms for corporate website并且正在使用它。我创建了一个模型来从ckeditor添加的数据库中获取数据。但不知何故,我正面临土耳其人的角色问题。如果有人可以帮助我,对于一个新的laravel开发人员来说非常好:)

我的数据库配置:

'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => null,
    ],

我的单一内容模型

namespace App\Model\Modules;

use App\Model\Config\Language;
use App\Model\Config\Menulist;
use Illuminate\Database\Eloquent\Model;

class SingleContent extends Model
{

/**
 * The table associated with the model.
 *
 * @var string
 */
public $table = "resimsiztekicerik";

/*
 * Set increment column name
 *
 * @var string
 */
protected $primaryKey = "entryId";

/**
 * Indicates if the model should be timestamped.
 *
 * @var bool
 */
public $timestamps = false;

// MASS ASSIGNMENT -------------------------------------------------------
// define which attributes are mass assignable (for security)
// we only want these 1 attributes able to be filled
protected $fillable = array('entryTitle','entryContent');


/*
 * get content of given menu id
 *
 * @param int
 *
 * @return array (database record row)
 */
public static function getContent($menuId)
{

    return SingleContent::where('langId',1)->where('menuId',1)->first();
}

}

我的AppController

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App;
use App\Model\Config\Language;
use App\Model\Config\Menulist;
use App\Model\Modules\SingleContent;

class AppController extends Controller
{

public function index()
{

    // about me content
    $about_me = SingleContent::getContent(1);

    // view datas
    $view_data = array();
    $view_data['about_me'] = $about_me;

    return view('app',$view_data);
}

}

我的app.blade

...
<meta charset="utf-8">
...
<div class="block">

  <div class="block-title">
    {{ $about_me->entryTitle }}
  </div>
  <div class="block-content">
    {!! $about_me->entryContent !!}
  </div>

</div>
...

{{$ about_me-&gt; entryTitle}}的结果:

Hakkımda

结果{!! $ about_me-&gt; entryContent !!}:

Web ProgramcılıÄı ile lisede tanıÅtım ve yapmam gereken mesleÄin bu  olduÄuna inanarak 1 yıllık stajımı tamamladıktan sonra 6 yıldır web geliÅtirme alanında profesyonel olarka hizmet veriyorum. Kurumsal websitesi, e-ticaret websitesi, otomasyon, vb. alanlarında çalıÅmalarım oldu.

修改

顺便说一句,这个我的记录看起来像在phpmyadmin中,我在列,表和数据库设置中使用utf8_geneal_ci,它在我的cms和codeigniter中看起来很好,但我不确定它是否正确。我缺乏编码经验。

enter image description here

2 个答案:

答案 0 :(得分:0)

尝试在Blade::setEchoFormat('e(utf8_encode(%s))');

的启动方法中添加AppServiceProvider

答案 1 :(得分:0)

我通过转换数据库,表格和列排序规则来解决它

来自

  

utf8_general_ci

  

utf8mb4_unicode_ci