本文整理汇总了PHP中URLify::add_chars方法的典型用法代码示例。如果您正苦于以下问题:PHP URLify::add_chars方法的具体用法?PHP URLify::add_chars怎么用?PHP URLify::add_chars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URLify
的用法示例。
在下文中一共展示了URLify::add_chars方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_add_chars
function test_add_chars()
{
$this->assertEquals('¿ ® ¼ ¼ ¾ ¶', URLify::downcode('¿ ® ¼ ¼ ¾ ¶'));
URLify::add_chars(array('¿' => '?', '®' => '(r)', '¼' => '1/4', '¼' => '1/2', '¾' => '3/4', '¶' => 'P'));
$this->assertEquals('? (r) 1/2 1/2 3/4 P', URLify::downcode('¿ ® ¼ ¼ ¾ ¶'));
}
示例2: post_edit_marker
public function post_edit_marker($id)
{
$input = Input::all();
$file = Input::file('img_input');
$rules = array('name' => 'required|max:150', 'address' => 'required|max:200', 'lat' => 'required|numeric', 'lng' => 'required|numeric', 'type' => 'required|alpha', 'img_input' => 'mimes:jpg,gif,png,jpeg|image');
$v = Validator::make($input, $rules);
if ($v->fails()) {
return Redirect::to_action('home@edit_marker/' . $id)->with_errors($v);
} else {
// save thumbnail
if (!empty($file['name'])) {
$success = Resizer::open($file)->resize(120, 100, 'landscape')->save('public/img/uploads/' . $file['name'], 90);
}
URLify::add_chars(array('á' => 'á', 'à' => 'à', 'ä' => 'ä', 'Á' => 'Á', 'À' => 'À', 'â' => 'â', 'Â' => 'Â', 'ã' => 'ã', 'Ã' => 'Ã', 'Ä' => 'Ä', 'Ç' => 'Ç', 'ç' => 'ç', 'é' => 'é', 'É' => 'É', 'è' => 'è', 'È' => 'È', 'ê' => 'ê', 'Ê' => 'Ê', 'ë' => 'ë', 'Ë' => 'Ë', 'ü' => 'ü', 'Ü' => 'Ü', 'û' => 'û', 'Û' => 'Û', 'ú' => 'ú', 'Ú' => 'Ú', 'ù' => 'ù', 'Ù' => 'Ù', 'ó' => 'ó', 'Ó' => 'Ó', 'ò' => 'ò', 'Ò' => 'Ò', 'ô' => 'ô', 'Ô' => 'Ô', 'ö' => 'ö', 'Ö' => 'Ö', 'ß' => 'ß', 'ÿ' => 'ÿ'));
$marker = Marker::where('id', '=', $id)->first();
$marker->name = URLify::downcode($input['name']);
$marker->address = URLify::downcode($input['address']);
$marker->lat = $input['lat'];
$marker->lng = $input['lng'];
$marker->type = $input['type'];
$marker->user_id = Auth::user()->group == 2 ? Auth::user()->id : $input['client'];
$marker->rem1 = URLify::downcode(Input::get('rem1', ''));
$marker->rem2 = URLify::downcode(Input::get('rem2', ''));
$marker->rem3 = URLify::downcode(Input::get('rem3', ''));
$marker->rem4 = URLify::downcode(Input::get('rem4', ''));
$marker->rem5 = URLify::downcode(Input::get('rem5', ''));
if (!empty($file['name'])) {
$marker->img_url = '/img/uploads/' . $file['name'];
}
$marker->save();
return Redirect::to_action('home@edit_marker/' . $id)->with('message', 'Marker updated!');
}
}