本文整理汇总了PHP中Str::ucfirst方法的典型用法代码示例。如果您正苦于以下问题:PHP Str::ucfirst方法的具体用法?PHP Str::ucfirst怎么用?PHP Str::ucfirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Str
的用法示例。
在下文中一共展示了Str::ucfirst方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: humanize
/**
* Turns an underscore or dash separated word and turns it into a human looking string.
*
* @param string $str the word
* @param string the separator (either _ or -)
* @param bool lowercare string and upper case first
* @return string the human version of given string
*/
public static function humanize($str, $sep = '_', $lowercase = true)
{
// Allow dash, otherwise default to underscore
$sep = $sep != '-' ? '_' : $sep;
if ($lowercase === true)
{
$str = \Str::ucfirst($str);
}
return str_replace($sep, " ", strval($str));
}
示例2: array
<?php
if (empty($option)) {
return;
}
Config::load('fee', true);
$config = Config::get('fee');
$intervals = array();
foreach ($config['intervals'] as $interval) {
$intervals[$interval] = $interval;
}
$interval_units = array();
foreach ($config['interval_units'] as $unit) {
$interval_units[$unit] = Str::ucfirst($unit);
}
$name = $interval = $interval_unit = $interval_price = null;
if (!empty($fee)) {
$name = $fee->name;
$interval = $fee->interval;
$interval_unit = $fee->interval_unit;
$interval_price = $fee->interval_price;
}
?>
<?php
echo Form::open(array('class' => 'form-horizontal form-validate'));
?>
<div class="control-group<?php
if (!empty($errors['name'])) {
echo ' error';
}
示例3: array
case 'active':
$status_label = ' label-success';
break;
case 'deleted':
$status_label = ' label-important';
break;
default:
$status_label = '';
}
?>
<span class="label<?php
echo $status_label;
?>
">
<?php
echo Str::ucfirst($key->status);
?>
</span>
</td>
<td>
<?php
if ($key->active()) {
echo Html::anchor($key->link('delete'), '<i class="icon icon-remove"></i> Delete', array('class' => 'action-link confirm', 'data-msg' => "Are you sure you want to delete this API key?"));
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
示例4: test_ucfirst
/**
* Test for Str::ucfirst()
*
* @test
*/
public function test_ucfirst()
{
$output = Str::ucfirst('hello world');
$expected = "Hello world";
$this->assertEquals($expected, $output);
}
示例5:
</td>
</tr>
<?php
echo '<?php endforeach; ?>';
?>
</tbody>
</table>
<?php
echo '<?php else: ?>';
?>
<p>No <?php
echo \Str::ucfirst($plural_name);
?>
.</p>
<?php
echo '<?php endif; ?>';
?>
<p>
<?php
echo '<?php';
?>
echo Html::anchor('<?php
echo $uri;
?>
/create', 'Add new <?php
echo \Inflector::humanize($singular_name);
示例6: array
case 'active':
$status_label = ' label-success';
break;
case 'deleted':
$status_label = ' label-important';
break;
default:
$status_label = '';
}
?>
<span class="label<?php
echo $status_label;
?>
">
<?php
echo Str::ucfirst($customer->status);
?>
</span>
</td>
<td>
<?php
echo Html::anchor($customer->link('contacts'), '<i class="icon icon-wrench"></i> Manage', array('class' => 'action-link'));
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
示例7: switch
<?php
switch ($product->status) {
case 'active':
$status_label = ' label-success';
break;
case 'canceled':
default:
$status_label = '';
}
?>
<span class="label <?php
echo $status_label;
?>
">
<?php
echo Str::ucfirst($product->status);
?>
</span>
</td>
<td>
<?php
if ($product->active()) {
echo Html::anchor($product->link('cancel'), '<i class="icon icon-remove"></i> Cancel', array('class' => 'action-link confirm', 'data-msg' => "Are you sure you want to cancel this customer's product?"));
} elseif ($product->canceled()) {
echo Html::anchor($product->link('activate'), '<i class="icon icon-repeat"></i> Activate', array('class' => 'action-link confirm', 'data-msg' => "Are you sure you want to activate this customer's product?"));
}
?>
</td>
</tr>
<?php
}
示例8: render
<h2>New <span class='muted'><?php
echo \Str::ucfirst($singular_name);
?>
</span></h2>
<br>
<?php
echo '<?php';
?>
echo render('<?php
echo $view_path;
?>
/_form'); ?>
<p><?php
echo '<?php';
?>
echo Html::anchor('<?php
echo $uri;
?>
', 'Back'); <?php
echo '?>';
?>
</p>
示例9: render
<h2 class="first">Editing <?php
echo \Str::ucfirst($singular);
?>
</h2>
<?php
echo '<?php';
?>
echo render('<?php
echo $controller_uri;
?>
/_form'); ?>
<br />
<p>
<?php
echo '<?php';
?>
echo Html::anchor('<?php
echo $controller_uri;
?>
/view/'.$<?php
echo $singular;
?>
->id, 'View'); <?php
echo '?>';
?>
|
<?php
echo '<?php';
?>
echo Html::anchor('<?php
示例10: camel
/**
* Cammelcases the input string stripping underscores and spaces
* @example
* input_string -> inputString
* input string -> inputString
* inputstring -> inputstring
* @param [type] $string
* @return [type]
*/
public static function camel($string)
{
$tok = strtok($string, "_ ");
$output = "";
while ($tok !== false) {
if (empty($output)) {
$output .= $tok;
} else {
$output .= Str::ucfirst($tok);
}
$tok = strtok("_ ");
}
return $output;
}
示例11: foreach
<h2 class="first">Listing <?php
echo \Str::ucfirst($plural);
?>
</h2>
<table cellspacing="0">
<tr>
<?php
foreach ($fields as $field) {
?>
<th><?php
echo \Inflector::humanize($field['name']);
?>
</th>
<?php
}
?>
<th></th>
</tr>
<?php
echo '<?php';
?>
foreach ($<?php
echo $plural;
?>
as $<?php
echo $singular;
?>
): <?php
echo '?>';
示例12: switch
switch ($option->status) {
case 'active':
$status_label = ' label-success';
break;
case 'deleted':
$status_label = ' label-important';
break;
default:
$status_label = '';
}
?>
<span class="label<?php
echo $status_label;
?>
">
<?php
echo Str::ucfirst($option->status);
?>
</span>
</td>
<td><?php
echo Html::anchor($option->link('edit'), '<i class="icon icon-wrench"></i> Configure', array('class' => 'action-link'));
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
示例13: array
case 'active':
$status_label = ' label-success';
break;
case 'deleted':
$status_label = ' label-important';
break;
default:
$status_label = '';
}
?>
<span class="label<?php
echo $status_label;
?>
">
<?php
echo Str::ucfirst($fee->status);
?>
</span>
</td>
<td>
<?php
echo Html::anchor($fee->link('edit'), '<i class="icon icon-pencil"></i> Edit', array('class' => 'action-link'));
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>