當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Inflector::ascii方法代碼示例

本文整理匯總了PHP中Inflector::ascii方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inflector::ascii方法的具體用法?PHP Inflector::ascii怎麽用?PHP Inflector::ascii使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Inflector的用法示例。


在下文中一共展示了Inflector::ascii方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: action_base64_encode_image

 public function action_base64_encode_image()
 {
     if ($_POST) {
         $asciiFormat = Inflector::ascii(Input::post('filename'));
         $webSafeName = Inflector::friendly_title($asciiFormat, '_', true);
         $uploadLocation = 'assets/img/upload/';
         $config = array('auto_process' => 'false', 'path' => DOCROOT . $uploadLocation, 'ext_whitelist' => array('img', 'jpg', 'jpeg', 'gif', 'png'), 'new_name' => $webSafeName, 'normalize' => true, 'change_case' => 'lower', 'auto_rename' => false, 'overwrite' => true);
         // process the uploaded files in $_FILES
         Upload::process($config);
         // if there are any valid files
         if (Upload::is_valid()) {
             // save them according to the config
             Upload::save();
             // Grab the file extension
             $uploadedFile = Upload::get_files(0);
             $filename = $webSafeName . '.' . $uploadedFile['extension'];
             $input_file = $uploadedFile['saved_to'] . $uploadedFile['saved_as'];
             $image64Encoded = $this->_base64_encode_image($input_file, $uploadedFile['extension']);
             $asset = Model_Asset::forge(array('name' => $uploadedFile['saved_as'], 'uri' => $uploadLocation, 'type' => $uploadedFile['extension']));
             $asset->save();
             return '<img src="' . $image64Encoded . '" />';
         } else {
             // and process any errors
             foreach (Upload::get_errors() as $key => $file) {
                 // $file is an array with all file information,
                 // $file['errors'] contains an array of all error occurred
                 // each array element is an an array containing 'error' and 'message'
                 //                Session::set_flash('error', $file['errors'] );
                 echo 'Error ' . $key . ' - ';
                 print_r($file['errors']);
                 echo ' <br />';
             }
             die;
         }
     }
     return;
 }
開發者ID:daniel-rodas,項目名稱:rodasnet.com,代碼行數:37,代碼來源:encoder.php

示例2: test_ascii

 /**
  * Test for Inflector::ascii()
  *
  * @test
  */
 public function test_ascii()
 {
     $output = Inflector::ascii('Inglés');
     $expected = "Ingles";
     $this->assertEquals($expected, $output);
 }
開發者ID:phabos,項目名稱:fuel-core,代碼行數:11,代碼來源:inflector.php


注:本文中的Inflector::ascii方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。