YII Framework学习之request与response用法(基于CHttpRequest响应),yiichttprequest
YII Framework学习之request与response用法(基于CHttpRequest响应),yiichttprequest
本文实例讲述了YII Framework学习之request与response用法。分享给大家供大家参考,具体如下:
YII中提供了CHttpRequest,封装了请求常用的方法。具体代码如下:
class CHttpRequest extends CApplicationComponent { public $enableCookieValidation=false; public $enableCsrfValidation=false; public $csrfTokenName='YII_CSRF_TOKEN'; public $csrfCookie; private $_requestUri; private $_pathInfo; private $_scriptFile; private $_scriptUrl; private $_hostInfo; private $_baseUrl; private $_cookies; private $_preferredLanguage; private $_csrfToken; private $_deleteParams; private $_putParams; public function init() { parent::init(); $this->normalizeRequest(); } protected function normalizeRequest() { // normalize request if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { if(isset($_GET)) $_GET=$this->stripSlashes($_GET); if(isset($_POST)) $_POST=$this->stripSlashes($_POST); if(isset($_REQUEST)) $_REQUEST=$this->stripSlashes($_REQUEST); if(isset($_COOKIE)) $_COOKIE=$this->stripSlashes($_COOKIE); } if($this->enableCsrfValidation) Yii::app()->attachEventHandler('onBeginRequest',array($this,'validateCsrfToken')); } public function stripSlashes(&$data) { return is_array($data)?array_map(array($this,'stripSlashes'),$data):stripslashes($data); } public function getParam($name,$defaultValue=null) { return isset($_GET[$name]) ? $_GET[$name] : (isset($_POST[$name]) ? $_POST[$name] : $defaultValue); } public function getQuery($name,$defaultValue=null) { return isset($_GET[$name]) ? $_GET[$name] : $defaultValue; } public function getPost($name,$defaultValue=null) { return isset($_POST[$name]) ? $_POST[$name] : $defaultValue; } public function getDelete($name,$defaultValue=null) { if($this->_deleteParams===null) $this->_deleteParams=$this->getIsDeleteRequest() ? $this->getRestParams() : array(); return isset($this->_deleteParams[$name]) ? $this->_deleteParams[$name] : $defaultValue; } public function getPut($name,$defaultValue=null) { if($this->_putParams===null) $this->_putParams=$this->getIsPutRequest() ? $this->getRestParams() : array(); return isset($this->_putParams[$name]) ? $this->_putParams[$name] : $defaultValue; } protected function getRestParams() { $result=array(); if(function_exists('mb_parse_str')) mb_parse_str(file_get_contents('php://input'), $result); else parse_str(file_get_contents('php://input'), $result); return $result; } public function getUrl() { return $this->getRequestUri(); } public function getHostInfo($schema='') { if($this->_hostInfo===null) { if($secure=$this->getIsSecureConnection()) $http='https'; else $http='http'; if(isset($_SERVER['HTTP_HOST'])) $this->_hostInfo=$http.'://'.$_SERVER['HTTP_HOST']; else { $this->_hostInfo=$http.'://'.$_SERVER['SERVER_NAME']; $port=$secure ? $this->getSecurePort() : $this->getPort(); if(($port!==80 && !$secure) || ($port!==443 && $secure)) $this->_hostInfo.=':'.$port; } } if($schema!=='') { $secure=$this->getIsSecureConnection(); if($secure && $schema==='https' || !$secure && $schema==='http') return $this->_hostInfo; $port=$schema==='https' ? $this->getSecurePort() : $this->getPort(); if($port!==80 && $schema==='http' || $port!==443 && $schema==='https') $port=':'.$port; else $port=''; $pos=strpos($this->_hostInfo,':'); return $schema.substr($this->_hostInfo,$pos,strcspn($this->_hostInfo,':',$pos+1)+1).$port; } else return $this->_hostInfo; } public function setHostInfo($value) { $this->_hostInfo=rtrim($value,'/'); } public function getBaseUrl($absolute=false) { if($this->_baseUrl===null) $this->_baseUrl=rtrim(dirname($this->getScriptUrl()),'\\/'); return $absolute ? $this->getHostInfo() . $this->_baseUrl : $this->_baseUrl; } public function setBaseUrl($value) { $this->_baseUrl=$value; } public function getScriptUrl() { if($this->_scriptUrl===null) { $scriptName=basename($_SERVER['SCRIPT_FILENAME']); if(basename($_SERVER['SCRIPT_NAME'])===$scriptName) $this->_scriptUrl=$_SERVER['SCRIPT_NAME']; else if(basename($_SERVER['PHP_SELF'])===$scriptName) $this->_scriptUrl=$_SERVER['PHP_SELF']; else if(isset($_SERVER['ORIG_SCRIPT_NAME']) && basename($_SERVER['ORIG_SCRIPT_NAME'])===$scriptName) $this->_scriptUrl=$_SERVER['ORIG_SCRIPT_NAME']; else if(($pos=strpos($_SERVER['PHP_SELF'],'/'.$scriptName))!==false) $this->_scriptUrl=substr($_SERVER['SCRIPT_NAME'],0,$pos).'/'.$scriptName; else if(isset($_SERVER['DOCUMENT_ROOT']) && strpos($_SERVER['SCRIPT_FILENAME'],$_SERVER['DOCUMENT_ROOT'])===0) $this->_scriptUrl=str_replace('\\','/',str_replace($_SERVER['DOCUMENT_ROOT'],'',$_SERVER['SCRIPT_FILENAME'])); else throw new CException(Yii::t('yii','CHttpRequest is unable to determine the entry script URL.')); } return $this->_scriptUrl; } public function setScriptUrl($value) { $this->_scriptUrl='/'.trim($value,'/'); } public function getPathInfo() { if($this->_pathInfo===null) { $pathInfo=$this->getRequestUri(); if(($pos=strpos($pathInfo,'?'))!==false) $pathInfo=substr($pathInfo,0,$pos); $pathInfo=urldecode($pathInfo); $scriptUrl=$this->getScriptUrl(); $baseUrl=$this->getBaseUrl(); if(strpos($pathInfo,$scriptUrl)===0) $pathInfo=substr($pathInfo,strlen($scriptUrl)); else if($baseUrl==='' || strpos($pathInfo,$baseUrl)===0) $pathInfo=substr($pathInfo,strlen($baseUrl)); else if(strpos($_SERVER['PHP_SELF'],$scriptUrl)===0) $pathInfo=substr($_SERVER['PHP_SELF'],strlen($scriptUrl)); else throw new CException(Yii::t('yii','CHttpRequest is unable to determine the path info of the request.')); $this->_pathInfo=trim($pathInfo,'/'); } return $this->_pathInfo; } public function getRequestUri() { if($this->_requestUri===null) { if(isset($_SERVER['HTTP_X_REWRITE_URL'])) // IIS $this->_requestUri=$_SERVER['HTTP_X_REWRITE_URL']; else if(isset($_SERVER['REQUEST_URI'])) { $this->_requestUri=$_SERVER['REQUEST_URI']; if(isset($_SERVER['HTTP_HOST'])) { if(strpos($this->_requestUri,$_SERVER['HTTP_HOST'])!==false) $this->_requestUri=preg_replace('/^\w+:\/\/[^\/]+/','',$this->_requestUri); } else $this->_requestUri=preg_replace('/^(http|https):\/\/[^\/]+/i','',$this->_requestUri); } else if(isset($_SERVER['ORIG_PATH_INFO'])) // IIS 5.0 CGI { $this->_requestUri=$_SERVER['ORIG_PATH_INFO']; if(!empty($_SERVER['QUERY_STRING'])) $this->_requestUri.='?'.$_SERVER['QUERY_STRING']; } else throw new CException(Yii::t('yii','CHttpRequest is unable to determine the request URI.')); } return $this->_requestUri; } public function getQueryString() { return isset($_SERVER['QUERY_STRING'])?$_SERVER['QUERY_STRING']:''; } public function getIsSecureConnection() { return isset($_SERVER['HTTPS']) && !strcasecmp($_SERVER['HTTPS'],'on'); } public function getRequestType() { return strtoupper(isset($_SERVER['REQUEST_METHOD'])?$_SERVER['REQUEST_METHOD']:'GET'); } public function getIsPostRequest() { return isset($_SERVER['REQUEST_METHOD']) && !strcasecmp($_SERVER['REQUEST_METHOD'],'POST'); } public function getIsDeleteRequest() { return isset($_SERVER['REQUEST_METHOD']) && !strcasecmp($_SERVER['REQUEST_METHOD'],'DELETE'); } public function getIsPutRequest() { return isset($_SERVER['REQUEST_METHOD']) && !strcasecmp($_SERVER['REQUEST_METHOD'],'PUT'); } public function getIsAjaxRequest() { return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH']==='XMLHttpRequest'; } public function getServerName() { return $_SERVER['SERVER_NAME']; } public function getServerPort() { return $_SERVER['SERVER_PORT']; } public function getUrlReferrer() { return isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:null; } public function getUserAgent() { return isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:null; } public function getUserHostAddress() { return isset($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:'127.0.0.1'; } public function getUserHost() { return isset($_SERVER['REMOTE_HOST'])?$_SERVER['REMOTE_HOST']:null; } public function getScriptFile() { if($this->_scriptFile!==null) return $this->_scriptFile; else return $this->_scriptFile=realpath($_SERVER['SCRIPT_FILENAME']); } public function getBrowser($userAgent=null) { return get_browser($userAgent,true); } public function getAcceptTypes() { return isset($_SERVER['HTTP_ACCEPT'])?$_SERVER['HTTP_ACCEPT']:null; } private $_port; public function getPort() { if($this->_port===null) $this->_port=!$this->getIsSecureConnection() && isset($_SERVER['SERVER_PORT']) ? (int)$_SERVER['SERVER_PORT'] : 80; return $this->_port; } public function setPort($value) { $this->_port=(int)$value; $this->_hostInfo=null; } private $_securePort; public function getSecurePort() { if($this->_securePort===null) $this->_securePort=$this->getIsSecureConnection() && isset($_SERVER['SERVER_PORT']) ? (int)$_SERVER['SERVER_PORT'] : 443; return $this->_securePort; } public function setSecurePort($value) { $this->_securePort=(int)$value; $this->_hostInfo=null; } public function getCookies() { if($this->_cookies!==null) return $this->_cookies; else return $this->_cookies=new CCookieCollection($this); } public function redirect($url,$terminate=true,$statusCode=302) { if(strpos($url,'/')===0) $url=$this->getHostInfo().$url; header('Location: '.$url, true, $statusCode); if($terminate) Yii::app()->end(); } public function getPreferredLanguage() { if($this->_preferredLanguage===null) { if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && ($n=preg_match_all('/([\w\-_]+)\s*(;\s*q\s*=\s*(\d*\.\d*))?/',$_SERVER['HTTP_ACCEPT_LANGUAGE'],$matches))>0) { $languages=array(); for($i=0;$i<$n;++$i) $languages[$matches[1][$i]]=empty($matches[3][$i]) ? 1.0 : floatval($matches[3][$i]); arsort($languages); foreach($languages as $language=>$pref) return $this->_preferredLanguage=CLocale::getCanonicalID($language); } return $this->_preferredLanguage=false; } return $this->_preferredLanguage; } public function sendFile($fileName,$content,$mimeType=null,$terminate=true) { if($mimeType===null) { if(($mimeType=CFileHelper::getMimeTypeByExtension($fileName))===null) $mimeType='text/plain'; } header('Pragma: public'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header("Content-type: $mimeType"); if(ini_get("output_handler")=='') header('Content-Length: '.(function_exists('mb_strlen') ? mb_strlen($content,'8bit') : strlen($content))); header("Content-Disposition: attachment; filename=\"$fileName\""); header('Content-Transfer-Encoding: binary'); if($terminate) { // clean up the application first because the file downloading could take long time // which may cause timeout of some resources (such as DB connection) Yii::app()->end(0,false); echo $content; exit(0); } else echo $content; } public function xSendFile($filePath, $options=array()) { if(!is_file($filePath)) return false; if(!isset($options['saveName'])) $options['saveName']=basename($filePath); if(!isset($options['mimeType'])) { if(($options['mimeType']=CFileHelper::getMimeTypeByExtension($filePath))===null) $options['mimeType']='text/plain'; } if(!isset($options['xHeader'])) $options['xHeader']='X-Sendfile'; header('Content-type: '.$options['mimeType']); header('Content-Disposition: attachment; filename="'.$options['saveName'].'"'); header(trim($options['xHeader']).': '.$filePath); if(!isset($options['terminate']) || $options['terminate']) Yii::app()->end(); return true; } public function getCsrfToken() { if($this->_csrfToken===null) { $cookie=$this->getCookies()->itemAt($this->csrfTokenName); if(!$cookie || ($this->_csrfToken=$cookie->value)==null) { $cookie=$this->createCsrfCookie(); $this->_csrfToken=$cookie->value; $this->getCookies()->add($cookie->name,$cookie); } } return $this->_csrfToken; } protected function createCsrfCookie() { $cookie=new CHttpCookie($this->csrfTokenName,sha1(uniqid(mt_rand(),true))); if(is_array($this->csrfCookie)) { foreach($this->csrfCookie as $name=>$value) $cookie->$name=$value; } return $cookie; } public function validateCsrfToken($event) { if($this->getIsPostRequest()) { // only validate POST requests $cookies=$this->getCookies(); if($cookies->contains($this->csrfTokenName) && isset($_POST[$this->csrfTokenName])) { $tokenFromCookie=$cookies->itemAt($this->csrfTokenName)->value; $tokenFromPost=$_POST[$this->csrfTokenName]; $valid=$tokenFromCookie===$tokenFromPost; } else $valid=false; if(!$valid) throw new CHttpException(400,Yii::t('yii','The CSRF token could not be verified.')); } } }
request操作的相关方法,一目了然。
public function init() { parent::init(); $this->normalizeRequest(); } protected function normalizeRequest() { // normalize request if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { if(isset($_GET)) $_GET=$this->stripSlashes($_GET); if(isset($_POST)) $_POST=$this->stripSlashes($_POST); if(isset($_REQUEST)) $_REQUEST=$this->stripSlashes($_REQUEST); if(isset($_COOKIE)) $_COOKIE=$this->stripSlashes($_COOKIE); } if($this->enableCsrfValidation) Yii::app()->attachEventHandler('onBeginRequest',array($this,'validateCsrfToken')); } public function stripSlashes(&$data) { return is_array($data)?array_map(array($this,'stripSlashes'),$data):stripslashes($data); }
可以看到yii对$_GET\$_POST\$_REQUEST\$_COOKIE进行了必要的过滤处理,所以可以放心的使用数据。
常用的有如下方法:
获取get参数
public function getParam($name,$defaultValue=null)
获取get参数
public function getQuery($name,$defaultValue=null)
获取post数据
public function getPost($name,$defaultValue=null)
获取请求的url
public function getUrl()
获取主机信息
public function getHostInfo($schema='')
设置
public function setHostInfo($value)
获取根目录
public function getBaseUrl($absolute=false)
获取当前url
public function getScriptUrl()
获取请求的url
public function getRequestUri()
获取querystring
public function getQueryString()
判断是否是https
public function getIsSecureConnection()
获取请求类型
public function getRequestType()
是否是post请求
public function getIsPostRequest()
是否是ajax请求
public function getIsAjaxRequest()
获取服务器名称
public function getServerName()
获取服务端口
public function getServerPort()
获取引用路径
public function getUrlReferrer()
获取用户ip地址
public function getUserHostAddress()
获取用户主机名称
public function getUserHost()
获取执行脚本名称
public function getScriptFile()
获取cookie
public function getCookies()
重定向
public function redirect($url,$terminate=true,$statusCode=302)
设置下载文件头
public function sendFile($fileName,$content,$mimeType=null,$terminate=true) { if($mimeType===null) { if(($mimeType=CFileHelper::getMimeTypeByExtension($fileName))===null) $mimeType='text/plain'; } header('Pragma: public'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header("Content-type: $mimeType"); if(ini_get("output_handler")=='') header('Content-Length: '.(function_exists('mb_strlen') ? mb_strlen($content,'8bit') : strlen($content))); header("Content-Disposition: attachment; filename=\"$fileName\""); header('Content-Transfer-Encoding: binary'); if($terminate) { // clean up the application first because the file downloading could take long time // which may cause timeout of some resources (such as DB connection) Yii::app()->end(0,false); echo $content; exit(0); } else echo $content; } public function xSendFile($filePath, $options=array()) { if(!is_file($filePath)) return false; if(!isset($options['saveName'])) $options['saveName']=basename($filePath); if(!isset($options['mimeType'])) { if(($options['mimeType']=CFileHelper::getMimeTypeByExtension($filePath))===null) $options['mimeType']='text/plain'; } if(!isset($options['xHeader'])) $options['xHeader']='X-Sendfile'; header('Content-type: '.$options['mimeType']); header('Content-Disposition: attachment; filename="'.$options['saveName'].'"'); header(trim($options['xHeader']).': '.$filePath); if(!isset($options['terminate']) || $options['terminate']) Yii::app()->end(); return true; }
为了防止csrf,yii提供了相应的方法
(
CSRF(Cross-site request forgery),中文名称:跨站请求伪造,也被称为:one click attack/session riding,缩写为:CSRF/XSRF。
《CSRF的攻击方式详解 黑客必备知识》
)
public function getCsrfToken() { if($this->_csrfToken===null) { $cookie=$this->getCookies()->itemAt($this->csrfTokenName); if(!$cookie || ($this->_csrfToken=$cookie->value)==null) { $cookie=$this->createCsrfCookie(); $this->_csrfToken=$cookie->value; $this->getCookies()->add($cookie->name,$cookie); } } return $this->_csrfToken; } protected function createCsrfCookie() { $cookie=new CHttpCookie($this->csrfTokenName,sha1(uniqid(mt_rand(),true))); if(is_array($this->csrfCookie)) { foreach($this->csrfCookie as $name=>$value) $cookie->$name=$value; } return $cookie; } public function validateCsrfToken($event) { if($this->getIsPostRequest()) { // only validate POST requests $cookies=$this->getCookies(); if($cookies->contains($this->csrfTokenName) && isset($_POST[$this->csrfTokenName])) { $tokenFromCookie=$cookies->itemAt($this->csrfTokenName)->value; $tokenFromPost=$_POST[$this->csrfTokenName]; $valid=$tokenFromCookie===$tokenFromPost; } else $valid=false; if(!$valid) throw new CHttpException(400,Yii::t('yii','The CSRF token could not be verified.')); } }
对于$_GET的使用,不仅仅可以使用$_GET和以上提供的相关方法,在action中,可以绑定到action的方法参数。
http://www.yiiframework.com/doc/guide/1.1/zh_cn/basics.controller
这里就一并罗列官方给出的说明。
从版本 1.1.4 开始,Yii 提供了对自动动作参数绑定的支持。 就是说,控制器动作可以定义命名的参数,参数的值将由 Yii 自动从 $_GET 填充。
为了详细说明此功能,假设我们需要为 PostController 写一个 create 动作。此动作需要两个参数:
category: 一个整数,代表帖子(post)要发表在的那个分类的ID。
language: 一个字符串,代表帖子所使用的语言代码。
从 $_GET 中提取参数时,我们可以不再下面这种无聊的代码了:
class PostController extends CController { public function actionCreate() { if(isset($_GET['category'])) $category=(int)$_GET['category']; else throw new CHttpException(404,'invalid request'); if(isset($_GET['language'])) $language=$_GET['language']; else $language='en'; // ... fun code starts here ... } }
现在使用动作参数功能,我们可以更轻松的完成任务:
class PostController extends CController { public function actionCreate($category, $language='en') { $category=(int)$category; // ... fun code starts here ... } }
注意我们在动作方法 actionCreate 中添加了两个参数。 这些参数的名字必须和我们想要从 $_GET 中提取的名字一致。 当用户没有在请求中指定 $language 参数时,这个参数会使用默认值 en 。 由于 $category 没有默认值,如果用户没有在 $_GET 中提供 category 参数, 将会自动抛出一个 CHttpException (错误代码 400) 异常。 Starting from version 1.1.5, Yii also supports array type detection for action parameters. This is done by PHP type hinting using the syntax like the following:
class PostController extends CController { public function actionCreate(array $categories) { // Yii will make sure $categories be an array } }
That is, we add the keyword array in front of $categories in the method parameter declaration. By doing so, if $_GET['categories'] is a simple string, it will be converted into an array consisting of that string.
Note: If a parameter is declared without the array type hint, it means the parameter must be a scalar (i.e., not an array). In this case, passing in an array parameter via $_GET would cause an HTTP exception.
request的使用你只要保持和以前在php中的使用方式一样,在yii中是不会出错的
更多关于Yii相关内容感兴趣的读者可查看本站专题:《Yii框架入门及常用技巧总结》、《php优秀开发框架总结》、《smarty模板入门基础教程》、《php日期与时间用法总结》、《php面向对象程序设计入门教程》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》
希望本文所述对大家基于Yii框架的PHP程序设计有所帮助。
您可能感兴趣的文章:
- YII Framework的filter过滤器用法分析
- 简介PHP的Yii框架中缓存的一些高级用法
- 深入解析PHP的Yii框架中的缓存功能
- PHP的Yii框架中View视图的使用进阶
- PHP的Yii框架中Model模型的学习教程
- 详解PHP的Yii框架中的Controller控制器
- Yii数据库缓存实例分析
- Yii开启片段缓存的方法
- 详解PHP的Yii框架中组件行为的属性注入和方法注入
- 详解在PHP的Yii框架中使用行为Behaviors的方法

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

.NETFramework4是開發人員和最終使用者在Windows上執行最新版本的應用程式所必需的。但是,在下載安裝.NETFramework4時,許多用戶抱怨安裝程式在中途停止,顯示以下錯誤訊息-「 .NETFramework4hasnotbeeninstalledbecauseDownloadfailedwitherrorcode0x800c0006 」。在您的裝置上安裝.NETFramework4時,如果您也在體驗它,那麼您就來對了地方

每當您的Windows11或Windows10PC出現升級或更新問題時,您通常會看到一個錯誤代碼,指示故障背後的實際原因。但是,有時,升級或更新失敗可能不會顯示錯誤代碼,這時就會混淆。有了方便的錯誤代碼,您可以確切地知道問題出在哪裡,因此您可以嘗試修復。但是由於沒有出現錯誤代碼,因此識別問題並解決它變得極具挑戰性。這會佔用您大量時間來簡單地找出錯誤背後的原因。在這種情況下,您可以嘗試使用Microsoft提供的名為SetupDiag的專用工具,該工具可協助您輕鬆識別錯誤背後的真
![SCNotification 已停止運作 [修復它的 5 個步驟]](https://img.php.cn/upload/article/000/887/227/168433050522031.png?x-oss-process=image/resize,m_fill,h_207,w_330)
身為Windows用戶,您很可能會在每次啟動電腦時遇到SCNotification已停止工作錯誤。 SCNotification.exe是一個微軟系統通知文件,由於權限錯誤和點網故障等原因,每次啟動PC時都會崩潰。此錯誤也以其問題事件名稱而聞名。因此,您可能不會將其視為SCNotification已停止工作,而是將其視為錯誤clr20r3。在本文中,我們將探討您需要採取的所有步驟來修復SCNotification已停止運作,以免它再次困擾您。什麼是SCNotification.e

request的中文意思是“請求”,是php中的一個全域變量,是一個包含了“$_POST”、“$_GET”和“$_COOKIE”的數組。 「$_REQUEST」變數可以取得POST或GET方式提交的資料、COOKIE資訊。

Laravel是一款流行的PHPWeb開發框架,提供了許多有用的功能和元件,包括回應返回。在Laravel中,回應回傳是一個非常重要的概念,因為它控制著Web應用程式向客戶端提供資訊的方式。在本文中,我們將詳細介紹Laravel回應回傳的各種方式以及如何使用LaravelResponse回傳回應。返回字串Laravel中,可以使用Response物件的

已安裝Microsoft.NET版本4.5.2、4.6或4.6.1的MicrosoftWindows用戶如果希望Microsoft將來透過產品更新支援該框架,則必須安裝較新版本的Microsoft框架。據微軟稱,這三個框架都將在2022年4月26日停止支援。支援日期結束後,產品將不會收到「安全修復或技術支援」。大多數家庭設備透過Windows更新保持最新。這些設備已經安裝了較新版本的框架,例如.NETFramework4.8。未自動更新的設備可能

Python3.x中如何使用urllib.request.urlopen()函數發送GET請求在網路程式設計中,我們經常需要透過發送HTTP請求來取得遠端伺服器的資料。在Python中,我們可以使用urllib模組中的urllib.request.urlopen()函數來傳送HTTP請求,並取得伺服器回傳的回應。本文將介紹如何使用

自從我們談論影響安裝KB5012643forWindows11的用戶的新安全模式錯誤以來已經過去了一周。這個討厭的問題並沒有出現在微軟在發布當天發布的已知問題清單中,因此讓所有人都感到驚訝。好吧,就在您認為情況不會變得更糟的時候,微軟為安裝此累積更新的用戶投下了另一顆炸彈。 Windows11Build22000.652導致更多問題因此,這家科技公司警告Windows11用戶,他們在啟動和使用某些.NETFramework3.5應用程式時可能會遇到問題。聽起來很熟悉?不過請不要驚
