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


PHP UrlHelper::GetActionUrl方法代碼示例

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


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

示例1: actionSend

 public function actionSend()
 {
     /* @var $contacts LuxContactInfo */
     $name = Yii::app()->request->getParam('name', null);
     $email = Yii::app()->request->getParam('mail', null);
     $message = Yii::app()->request->getParam('message', null);
     $cap_id = Yii::app()->request->getParam('cap_id', null);
     $cap = Yii::app()->request->getParam('cap', null);
     $contacts = LuxContactInfo::model()->findAll();
     if (count($contacts) > 0) {
         $contact = $contacts[0];
     } else {
         $contact = new LuxContactInfo();
     }
     $success = false;
     if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
         $captcha = new DwCaptcha();
         if (strlen($message) < 7 || !$captcha->CheckCaptcha($cap, $cap_id)) {
             $success = false;
         }
         if (strlen($message) > 7 && $captcha->CheckCaptcha($cap, $cap_id)) {
             $subject = $contact->getLngObject(Yii::app()->language)->feedback_subject;
             $to = $contact->administrator_email;
             //send email
             $headers = array();
             $headers[] = "MIME-Version: 1.0";
             $headers[] = "Content-type: text/plain; charset=iso-8859-1";
             $headers[] = "From: " . $name . " <" . $email . ">";
             $headers[] = "Subject: {$subject}";
             $headers[] = "X-Mailer: PHP/" . phpversion();
             $success = mail($to, $subject, $message, implode("\r\n", $headers));
         }
     }
     if ($success) {
         $this->redirect(UrlHelper::GetActionUrl('pages', 'index') . '#contacts');
     } else {
         $this->redirect(UrlHelper::GetActionUrl('pages', 'index', array('error' => 1)) . '#contacts');
     }
 }
開發者ID:ruslankus,項目名稱:inlux-transfer,代碼行數:39,代碼來源:FeedbackController.php

示例2: DwCaptcha

<?php

/* @var $capObj CaptchaObject */
/* @var $error bool */
?>

<form method="post" action="<?php 
echo UrlHelper::GetActionUrl('feedback', 'send');
?>
">
    <div class="feedback-data">
        <input type="text" name="name" placeholder="Name">
        <input type="text" name="mail" placeholder="Mail">

        <div class="captcha">
            <p><?php 
echo Translations::Translate('Enter symbols');
?>
 <br> <?php 
echo Translations::Translate('in the picture');
?>
</p>
            <?php 
$cap = new DwCaptcha();
$capObj = $cap->GetRandomCaptcha();
?>
            <input type="hidden" name="cap_id" value="<?php 
echo $capObj->GetId();
?>
">
            <img style="width: 90px; height: 40px" src="<?php 
開發者ID:ruslankus,項目名稱:inlux-transfer,代碼行數:31,代碼來源:contacts_form.php


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