SCRIPT438:对象不支持"handleError"属性或方法,文件上传功能 20C

写了一个文件上传功能,本地运行没问题,放在服务器上就报错,希望有大神能告诉下原因。本地是ie9的,服务器上是ie8图片说明

1.前端代码:图片说明
图片说明
图片说明
2.后台代码:图片说明

1个回答

建议你升级服务器IE版本。IE8的兼容性较IE9都差很多,更别提和现在的IE11了。你用的第三方JQUERY包,里面封装的一些函数IE8下可能出现无法解析的情况。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
文件上传$.ajaxFileUpload is not a function

使用ajaxFileUpload进行文件上传,在chrome浏览器脚本控制台报错:$.ajaxFileUpload is not a function,点击上传按钮没有响应。 代码如下: ``` <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/ajaxfileupload.js"></script> <script type="text/javascript"> function uploadFileByAjax() { //验证文件是否选择文件 var fileObj = $("#uploadFile"); var fileName = fileObj.attr("value"); if(fileName == null || fileName == ""){ return; } alert(fileName); $.ajaxFileUpload({ url : "/Itil/attamgn/upload", //需要链接到服务器地址 secureuri : false, fileElementId : "uploadFile", //文件选择框的id属性 dataType : "json", //服务器返回的格式,可以是json, xml success : function(data, status) //相当于java中try语句块的用法 { //alert("记录ID:" + data.seqId); //alert("文件名:" + data.uplName); attList.push(data.seqId); //修改显示文件列表 var content = "<li id=\"file" + fileIndex + "\" class=\"one-line border-radius-all attach\"><span class=\"name one-line\"><a class=\"ico ico-attach text\">"; content = content + data.uplName + "</a></span>"; content = content + "<span class=\"tool\"><a class=\"ico ico-remove hover\" title=\"删除\" onclick=\"deleteUploadFile('file"+fileIndex + "', '"+ data.seqId +"')\"></a></span></li>"; content = content + $("#fileList").html(); $("#fileList").html(content); }, error : function(data, status, e) //相当于java中catch语句块的用法 { alert("上传失败"); } } ); } </script> <body> <a><span id="" class="ico ico16 ico-attach hover ml10" title="添加附件" onclick="uploadFileByAjax(); return false; "></span></a> </body> ``` 哪位大神指点一下啊! 从访问时的页面源码可以进入引入的jquery.min.js和ajaxfileupload.js文件,可以确认引入没问题。

网页里的一段超级复杂的javascript代码,不知道做什么用的,问了几个高手都无法解答

第一段: <script type="text/javascript"> /*<![CDATA[*/ var DataBrainConfig = {'SiteId':'5960','ConfigurationId':'1','AutoIntegration':true,'checkTimeMeter':1,'useDMP':true,'timeRequestLimit':500,'dmpPartnerKey':'6SysO2MEZq69sDxIvJm58g2','customAttributes':[{'Name':'vertical','Value':'dating'}]};var data_brain = false; var JSON; if (!JSON) { JSON = {}; } if (typeof JSON.stringify !== 'function') { JSON.stringify = function (value, replacer, space) { var i; gap = ''; indent = ''; if (typeof space === 'number') { for (i = 0; i < space; i += 1) { indent += ' '; } } else if (typeof space === 'string') { indent = space; } rep = replacer; if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { throw new Error('JSON.stringify'); } return str('', { '': value }); }; } /** * * @constructor */ function DataBrain() { this.TrackerUrl = 'http://tracker.databrain.com'; this.AT_LOADPAGE = 1; this.siteid = 0; this.cfid = 0; this.at = 0; this.vid = 0; this.checkTimeMeter = 0; this.startTime = 0; this.startResponseTime = 0; this.endTime = 0; this.trackError = 0; this.RequestStatuses = ['start', 'progress', 'finished', 'error']; this.requestStatus = this.RequestStatuses[0]; this.methods = ['ajax', 'script']; this.method = this.methods[1]; this.ap = {}; this.timeRequestLimit = 300; this.useDMP = false; this.mergeData = {}; this.dmpPartnerKey = ''; this.ca = []; this.init(); } /** * init */ DataBrain.prototype.init = function() { this.getVid(); this.setParam(); if ( 0 != this.checkTimeMeter) { this.startTrackMeter(); } this.trackDataBrain(); }; /** * Start Track Meter */ DataBrain.prototype.startTrackMeter = function() { this.startTime = new Date().getTime(); }; /** * Start Track Response Meter */ DataBrain.prototype.startReponseMeter = function() { this.startResponseTime = new Date().getTime(); }; /** * End Track Meter */ DataBrain.prototype.endTrackMeter = function() { this.endTime = new Date().getTime(); }; /** * End Track Meter */ DataBrain.prototype.getTrackMeterTime = function() { var timeDiff = this.endTime - this.startTime; return timeDiff; }; DataBrain.prototype.getCurrentMeterTime = function() { return new Date().getTime() - this.startResponseTime; } /** * Get Vid */ DataBrain.prototype.getVid = function() { this.vid = document.cookie.substr(document.cookie.indexOf('vid=')+4, 36); }; /** * * @param cookieName * @param cookieValue * @param nDays * @constructor */ DataBrain.prototype.SetCookie = function(cookieName,cookieValue,nDays) { var today = new Date(); var expire = new Date(); if (nDays==null || nDays==0) nDays=1; expire.setTime(today.getTime() + 3600000*24*nDays); document.cookie = cookieName+'='+escape(cookieValue) + ';expires='+expire.toGMTString() + ';path=/'; }; /** * Set Vid To Cookie */ DataBrain.prototype.setVid = function(vid) { this.SetCookie('vid', vid, 365); }; /** * Check Vid * @returns {boolean} */ DataBrain.prototype.isSettedVid = function() { var result = false; if ( 0 < parseInt(this.vid) ) { result = true; } return result; }; /** * Set Parameters to track action in DataBrain */ DataBrain.prototype.setParam = function() { this.siteid = DataBrainConfig.SiteId; this.cfid = parseInt(DataBrainConfig.ConfigurationId); this.at = parseInt(DataBrainConfig.AutoIntegration); this.checkTimeMeter = parseInt(DataBrainConfig.checkTimeMeter); this.ap = this.getActionParam(); this.ca = DataBrainConfig.customAttributes; this.useDMP = DataBrainConfig.useDMP; this.timeRequestLimit = parseInt(DataBrainConfig.timeRequestLimit); this.dmpPartnerKey = DataBrainConfig.dmpPartnerKey; }; /** * Return parameters of page to Action * @returns {{Content: string, Referrer: string, Title: string}} */ DataBrain.prototype.getActionParam = function() { var _location = document.location.href.substring(0, 300); var _referrer = document.referrer.substring(0, 300); var _title = document.title.substring(0, 300); return { Content: _location, Referrer: _referrer, Title: _title }; }; /** * init request to trackDataBrain */ DataBrain.prototype.trackDataBrain = function() { if ( this.methods[1] == this.method ) { this.scriptDataBrain(); } else { this.requestToDataBrain(); } }; /** * Prepare Data to send request * @returns {string} */ DataBrain.prototype.prepareData = function() { var params = 'siteid=' + this.siteid + '&cfid=' + this.cfid + '&at=' + this.AT_LOADPAGE; if (this.useDMP != true) { params = '/track.ashx?' + params; } else { params = '/bridge.ashx?' + params + '&partnerKey=' + this.dmpPartnerKey; } params += (this.ap == {} ? '' : '&ap=' + escape(JSON.stringify(this.ap))); params += (this.ca ? '&ca=' + escape(JSON.stringify(this.ca)) : ''); return params; }; /** * Prepare Data to send request * @returns {string} */ DataBrain.prototype.prepareDataScript = function() { var params = 'siteid=' + this.siteid + '&cfid=' + this.cfid + '&at=' + this.AT_LOADPAGE; if (this.useDMP != true) { params = '/track.ashx?' + params; } else { params = '/bridge.ashx?' + params + '&partnerKey=' + this.dmpPartnerKey; } params += (this.ap == {} ? '' : '&ap=' + encodeURIComponent(JSON.stringify(this.ap))); params += (this.ca ? '&ca=' + encodeURIComponent(JSON.stringify(this.ca)) : ''); return params; }; /** * Send request */ DataBrain.prototype.requestToDataBrain = function() { var req = new XMLHttpRequest(); var body = ''; var self = this; this.requestStatus = this.RequestStatuses[1]; if ('withCredentials' in req) { self.startReponseMeter(); req.open('GET', this.TrackerUrl + this.prepareData(), true); req.onreadystatechange = function() { if (req.readyState === 4) { if (req.status >= 200 && req.status < 400) { var res = req.responseText; if (self.useDMP == true) { self.handleResponseDMP(self, res); } else { self.handleResponse(self, res); } } else { self.handleError(self); } } }; req.send(body); } }; /** * Request script */ DataBrain.prototype.scriptDataBrain = function() { var req = new XMLHttpRequest(); var body = ''; var self = this; this.requestStatus = this.RequestStatuses[1]; document.addEventListener('DOMContentLoaded', function(){ var script = document.createElement('script'); self.startReponseMeter(); script.setAttribute('src', self.TrackerUrl + self.prepareDataScript()); document.body.appendChild(script); script.onload = function(){ if (self.useDMP == true) { self.handleResponseDMP(self); } else { self.handleResponse(self); } }; }); }; /** * Request Callback */ DataBrain.prototype.handleResponse = function(self, res) { if ( this.methods[1] != this.method ) { eval(res); } if ( !self.isSettedVid() || self.vid != ___dbVid ) { self.setVid(___dbVid); } self.requestStatus = this.RequestStatuses[2]; if ( 0 != self.checkTimeMeter) { self.endTrackMeter(); console.log(self.getTrackMeterTime()); } }; /** * Request Callback using DMP data */ DataBrain.prototype.handleResponseDMP = function(self, res) { // console.log(self.TrackerUrl + self.prepareDataScript()); if ( this.methods[1] != this.method ) { eval(res); } if (typeof ___dbDmpVisit.Vid !== "undefined") { if ( !self.isSettedVid() || self.vid != ___dbDmpVisit.Vid ) { self.setVid(___dbDmpVisit.Vid); } } if (typeof ___dbDmpVisit.SessionStats !== "undefined") { self.setMergeData(___dbDmpVisit); } self.requestStatus = this.RequestStatuses[2]; if ( 0 != self.checkTimeMeter) { self.endTrackMeter(); // console.log(self.getTrackMeterTime()); } }; /** * Request Callback */ DataBrain.prototype.handleError = function(self) { self.trackError = 1; self.requestStatus = this.RequestStatuses[3]; }; DataBrain.prototype.getMergeData = function() { return this.mergeData; }; DataBrain.prototype.getData = function() { return (this.mergeData.dmpData) ? this.mergeData.dmpData : {}; } DataBrain.prototype.setMergeData = function(data) { this.mergeData.dmpData = data; this.mergeData.dbTimeScript = this.getCurrentMeterTime(); }; /** * Function Track action to DataBrain and get parameter Vid */ (function() { data_brain = new DataBrain(); })(); /*]]>*/ </script> 第二段: <script type="text/javascript"> /*<![CDATA[*/ var _isGotoJump = false; window.open=function(url){ if(!_isGotoJump) {location.href=url; _isGotoJump = true; return false;}} document.body.style.display = 'none'; autoLogin = { href : 'http://www.xxxx.com/site/redirectpage?ca=link&sid=6170&trid=16596&hv=f5fb029be166ab63f639a6e7c0e794b1', tRid : '16596', sid : 6170, rules : [{"name":"Rule0","conditions":[{"domain":"benaughty.com","condition":"!=","count":"0"}],"url":"http:\/\/www.targeturl.com\/ext.php?dynamicpage=5step_focus&a_aid=adsbr","parameters":"static"}], useDMP : true }; var hv="f5fb029be166ab63f639a6e7c0e794b1";document.addEventListener("DOMContentLoaded", function(event) {var link = document.getElementsByTagName('a');for(var i=0;i<link.length;i++){attribute = link[i].getAttribute('onclick');if(Boolean(attribute) && attribute.match('\/site\/redirectpage')){link[i].setAttribute('onclick', attribute.replace("',", "&hv=" + hv + "',"));}}}); /*]]>*/ </script>

php密码中的登录错误与sql数据库相比

<div class="post-text" itemprop="text"> <p>This code works beautifully to send the information put in the registry to the sql server, but is returning with "<strong>Error logging in. The username or password does not match</strong>" when I try to login using the data that was inputted during registration. I can see it in the database after it was created in registry to make sure I am typing everything correctly. I am almost certain the issue is around the <strong>CheckLoginInDB</strong> function, but it is rather difficult for me to find.</p> <p>I want the code to compare the password correctly without returning the error and allowing a login.</p> <pre><code> &lt;?PHP /* Registration/Login script from HTML Form Guide V1.0 This program is free software published under the terms of the GNU Lesser General Public License. http://www.gnu.org/copyleft/lesser.html This program is distributed in the hope that it will be useful - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For updates, please visit: http://www.html-form-guide.com/php-form/php-registration-form.html http://www.html-form-guide.com/php-form/php-login-form.html */ require_once("class.phpmailer.php"); require_once("formvalidator.php"); class FGMembersite { var $admin_email; var $from_address; var $username; var $pwd; var $database; var $tablename; var $connection; var $rand_key; var $error_message; //-----Initialization ------- function FGMembersite() { $this-&gt;sitename = 'YourWebsiteName.com'; $this-&gt;rand_key = '0iQx5oBk66oVZep'; } function InitDB($host,$uname,$pwd,$database,$tablename) { $this-&gt;db_host = $host; $this-&gt;username = $uname; $this-&gt;pwd = $pwd; $this-&gt;database = $database; $this-&gt;tablename = $tablename; } function SetAdminEmail($email) { $this-&gt;admin_email = $email; } function SetWebsiteName($sitename) { $this-&gt;sitename = $sitename; } function SetRandomKey($key) { $this-&gt;rand_key = $key; } //-------Main Operations ---------------------- function RegisterUser() { if(!isset($_POST['submitted'])) { return false; } $formvars = array(); if(!$this-&gt;ValidateRegistrationSubmission()) { return false; } $this-&gt;CollectRegistrationSubmission($formvars); if(!$this-&gt;SaveToDatabase($formvars)) { return false; } if(!$this-&gt;SendUserConfirmationEmail($formvars)) { return false; } $this-&gt;SendAdminIntimationEmail($formvars); return true; } function ConfirmUser() { if(empty($_GET['code'])||strlen($_GET['code'])&lt;=10) { $this-&gt;HandleError("Please provide the confirm code"); return false; } $user_rec = array(); if(!$this-&gt;UpdateDBRecForConfirmation($user_rec)) { return false; } $this-&gt;SendUserWelcomeEmail($user_rec); $this-&gt;SendAdminIntimationOnRegComplete($user_rec); return true; } function Login() { if(empty($_POST['username'])) { $this-&gt;HandleError("UserName is empty!"); return false; } if(empty($_POST['password'])) { $this-&gt;HandleError("Password is empty!"); return false; } $username = trim($_POST['username']); $password = trim($_POST['password']); if(!isset($_SESSION)){ session_start(); } if(!$this-&gt;CheckLoginInDB($username,$password)) { return false; } $_SESSION[$this-&gt;GetLoginSessionVar()] = $username; $_SESSION[$this-&gt;GetLoginSessionVar()] = $password; return true; } function CheckLogin() { if(!isset($_SESSION)){ session_start(); } $sessionvar = $this-&gt;GetLoginSessionVar(); if(empty($_SESSION[$sessionvar])) { return false; } return true; } function UserFullName() { return isset($_SESSION['name_of_user'])?$_SESSION['name_of_user']:''; } function UserEmail() { return isset($_SESSION['email_of_user'])?$_SESSION['email_of_user']:''; } function LogOut() { session_start(); $sessionvar = $this-&gt;GetLoginSessionVar(); $_SESSION[$sessionvar]=NULL; unset($_SESSION[$sessionvar]); } function EmailResetPasswordLink() { if(empty($_POST['email'])) { $this-&gt;HandleError("Email is empty!"); return false; } $user_rec = array(); if(false === $this-&gt;GetUserFromEmail($_POST['email'], $user_rec)) { return false; } if(false === $this-&gt;SendResetPasswordLink($user_rec)) { return false; } return true; } function ResetPassword() { if(empty($_GET['email'])) { $this-&gt;HandleError("Email is empty!"); return false; } if(empty($_GET['code'])) { $this-&gt;HandleError("reset code is empty!"); return false; } $email = trim($_GET['email']); $code = trim($_GET['code']); if($this-&gt;GetResetPasswordCode($email) != $code) { $this-&gt;HandleError("Bad reset code!"); return false; } $user_rec = array(); if(!$this-&gt;GetUserFromEmail($email,$user_rec)) { return false; } $new_password = $this-&gt;ResetUserPasswordInDB($user_rec); if(false === $new_password || empty($new_password)) { $this-&gt;HandleError("Error updating new password"); return false; } if(false == $this-&gt;SendNewPassword($user_rec,$new_password)) { $this-&gt;HandleError("Error sending new password"); return false; } return true; } function ChangePassword() { if(!$this-&gt;CheckLogin()) { $this-&gt;HandleError("Not logged in!"); return false; } if(empty($_POST['oldpwd'])) { $this-&gt;HandleError("Old password is empty!"); return false; } if(empty($_POST['newpwd'])) { $this-&gt;HandleError("New password is empty!"); return false; } $user_rec = array(); if(!$this-&gt;GetUserFromEmail($this-&gt;UserEmail(),$user_rec)) { return false; } $pwd = trim($_POST['oldpwd']); if($user_rec['password'] != md5($pwd)) { $this-&gt;HandleError("The old password does not match!"); return false; } $newpwd = trim($_POST['newpwd']); if(!$this-&gt;ChangePasswordInDB($user_rec, $newpwd)) { return false; } return true; } //-------Public Helper functions ------------- function GetSelfScript() { return htmlentities($_SERVER['PHP_SELF']); } function SafeDisplay($value_name) { if(empty($_POST[$value_name])) { return''; } return htmlentities($_POST[$value_name]); } function RedirectToURL($url) { header("Location: $url"); exit; } function GetSpamTrapInputName() { return 'sp'.md5('KHGdnbvsgst'.$this-&gt;rand_key); } function GetErrorMessage() { if(empty($this-&gt;error_message)) { return ''; } $errormsg = nl2br(htmlentities($this-&gt;error_message)); return $errormsg; } //-------Private Helper functions----------- function HandleError($err) { $this-&gt;error_message .= $err." "; } function HandleDBError($err) { $this-&gt;HandleError($err." mysqlerror:".mysql_error()); } function GetFromAddress() { if(!empty($this-&gt;from_address)) { return $this-&gt;from_address; } $host = $_SERVER['SERVER_NAME']; $from ="nobody@$host"; return $from; } function GetLoginSessionVar() { $retvar = md5($this-&gt;rand_key); $retvar = 'usr_'.substr($retvar,0,10); return $retvar; } function CheckLoginInDB($username,$password) { if(!$this-&gt;DBLogin()) { $this-&gt;HandleError("Database login failed!"); return false; } $username = $this-&gt;SanitizeForSQL($username); $pwdmd5 = md5($password); $qry = "Select name, email from $this-&gt;tablename where username='$username' and password='$pwdmd5' and confirmcode='y'"; $result = mysql_query($qry,$this-&gt;connection); if(!$result || mysql_num_rows($result) &lt;= 0) { $this-&gt;HandleError("Error logging in. The username or password does not match"); return false; } $row = mysql_fetch_assoc($result); $_SESSION['name_of_user'] = $row['name']; $_SESSION['email_of_user'] = $row['email']; return true; } function UpdateDBRecForConfirmation(&amp;$user_rec) { if(!$this-&gt;DBLogin()) { $this-&gt;HandleError("Database login failed!"); return false; } $confirmcode = $this-&gt;SanitizeForSQL($_GET['code']); $result = mysql_query("Select name, email from $this-&gt;tablename where confirmcode='$confirmcode'",$this-&gt;connection); if(!$result || mysql_num_rows($result) &lt;= 0) { $this-&gt;HandleError("Wrong confirm code."); return false; } $row = mysql_fetch_assoc($result); $user_rec['name'] = $row['name']; $user_rec['email']= $row['email']; $qry = "Update $this-&gt;tablename Set confirmcode='y' Where confirmcode='$confirmcode'"; if(!mysql_query( $qry ,$this-&gt;connection)) { $this-&gt;HandleDBError("Error inserting data to the table query:$qry"); return false; } return true; } function ResetUserPasswordInDB($user_rec) { $new_password = substr(md5(uniqid()),0,10); if(false == $this-&gt;ChangePasswordInDB($user_rec,$new_password)) { return false; } return $new_password; } function ChangePasswordInDB($user_rec, $newpwd) { $newpwd = $this-&gt;SanitizeForSQL($newpwd); $qry = "Update $this-&gt;tablename Set password='".md5($newpwd)."' Where id_user=".$user_rec['id_user'].""; if(!mysql_query( $qry ,$this-&gt;connection)) { $this-&gt;HandleDBError("Error updating the password query:$qry"); return false; } return true; } function GetUserFromEmail($email,&amp;$user_rec) { if(!$this-&gt;DBLogin()) { $this-&gt;HandleError("Database login failed!"); return false; } $email = $this-&gt;SanitizeForSQL($email); $result = mysql_query("Select * from $this-&gt;tablename where email='$email'",$this-&gt;connection); if(!$result || mysql_num_rows($result) &lt;= 0) { $this-&gt;HandleError("There is no user with email: $email"); return false; } $user_rec = mysql_fetch_assoc($result); return true; } function SendUserWelcomeEmail(&amp;$user_rec) { $mailer = new PHPMailer(); $mailer-&gt;CharSet = 'utf-8'; $mailer-&gt;AddAddress($user_rec['email'],$user_rec['name']); $mailer-&gt;Subject = "Welcome to ".$this-&gt;sitename; $mailer-&gt;From = $this-&gt;GetFromAddress(); $mailer-&gt;Body ="Hello ".$user_rec['name']." ". "Welcome! Your registration with ".$this-&gt;sitename." is completed. ". " ". "Regards, ". "Webmaster ". $this-&gt;sitename; if(!$mailer-&gt;Send()) { $this-&gt;HandleError("Failed sending user welcome email."); return false; } return true; } function SendAdminIntimationOnRegComplete(&amp;$user_rec) { if(empty($this-&gt;admin_email)) { return false; } $mailer = new PHPMailer(); $mailer-&gt;CharSet = 'utf-8'; $mailer-&gt;AddAddress($this-&gt;admin_email); $mailer-&gt;Subject = "Registration Completed: ".$user_rec['name']; $mailer-&gt;From = $this-&gt;GetFromAddress(); $mailer-&gt;Body ="A new user registered at ".$this-&gt;sitename." ". "Name: ".$user_rec['name']." ". "Email address: ".$user_rec['email']." "; if(!$mailer-&gt;Send()) { return false; } return true; } function GetResetPasswordCode($email) { return substr(md5($email.$this-&gt;sitename.$this-&gt;rand_key),0,10); } function SendResetPasswordLink($user_rec) { $email = $user_rec['email']; $mailer = new PHPMailer(); $mailer-&gt;CharSet = 'utf-8'; $mailer-&gt;AddAddress($email,$user_rec['name']); $mailer-&gt;Subject = "Your reset password request at ".$this-&gt;sitename; $mailer-&gt;From = $this-&gt;GetFromAddress(); $link = $this-&gt;GetAbsoluteURLFolder(). '/resetpwd.php?email='. urlencode($email).'&amp;code='. urlencode($this-&gt;GetResetPasswordCode($email)); $mailer-&gt;Body ="Hello ".$user_rec['name']." ". "There was a request to reset your password at ".$this-&gt;sitename." ". "Please click the link below to complete the request: ".$link." ". "Regards, ". "Webmaster ". $this-&gt;sitename; if(!$mailer-&gt;Send()) { return false; } return true; } function SendNewPassword($user_rec, $new_password) { $email = $user_rec['email']; $mailer = new PHPMailer(); $mailer-&gt;CharSet = 'utf-8'; $mailer-&gt;AddAddress($email,$user_rec['name']); $mailer-&gt;Subject = "Your new password for ".$this-&gt;sitename; $mailer-&gt;From = $this-&gt;GetFromAddress(); $mailer-&gt;Body ="Hello ".$user_rec['name']." ". "Your password is reset successfully. ". "Here is your updated login: ". "username:".$user_rec['username']." ". "password:$new_password ". " ". "Login here: ".$this-&gt;GetAbsoluteURLFolder()."/login.php ". " ". "Regards, ". "Webmaster ". $this-&gt;sitename; if(!$mailer-&gt;Send()) { return false; } return true; } function ValidateRegistrationSubmission() { //This is a hidden input field. Humans won't fill this field. if(!empty($_POST[$this-&gt;GetSpamTrapInputName()]) ) { //The proper error is not given intentionally $this-&gt;HandleError("Automated submission prevention: case 2 failed"); return false; } $validator = new FormValidator(); $validator-&gt;addValidation("name","req","Please fill in Name"); $validator-&gt;addValidation("email","email","The input for Email should be a valid email value"); $validator-&gt;addValidation("email","req","Please fill in Email"); $validator-&gt;addValidation("username","req","Please fill in UserName"); $validator-&gt;addValidation("password","req","Please fill in Password"); if(!$validator-&gt;ValidateForm()) { $error=''; $error_hash = $validator-&gt;GetErrors(); foreach($error_hash as $inpname =&gt; $inp_err) { $error .= $inpname.':'.$inp_err." "; } $this-&gt;HandleError($error); return false; } return true; } function CollectRegistrationSubmission(&amp;$formvars) { $formvars['name'] = $this-&gt;Sanitize($_POST['name']); $formvars['email'] = $this-&gt;Sanitize($_POST['email']); $formvars['username'] = $this-&gt;Sanitize($_POST['username']); $formvars['password'] = $this-&gt;Sanitize($_POST['password']); } function SendUserConfirmationEmail(&amp;$formvars) { $mailer = new PHPMailer(); $mailer-&gt;CharSet = 'utf-8'; $mailer-&gt;AddAddress($formvars['email'],$formvars['name']); $mailer-&gt;Subject = "Your registration with ".$this-&gt;sitename; $mailer-&gt;From = $this-&gt;GetFromAddress(); $confirmcode = $formvars['confirmcode']; $confirm_url = $this-&gt;GetAbsoluteURLFolder().'/confirmreg.php?code='.$confirmcode; $mailer-&gt;Body ="Hello ".$formvars['name']." ". "Thanks for your registration with ".$this-&gt;sitename." ". "Please click the link below to confirm your registration. ". "$confirm_url ". " ". "Regards, ". "Webmaster ". $this-&gt;sitename; if(!$mailer-&gt;Send()) { $this-&gt;HandleError("Failed sending registration confirmation email."); return false; } return true; } function GetAbsoluteURLFolder() { $scriptFolder = (isset($_SERVER['HTTPS']) &amp;&amp; ($_SERVER['HTTPS'] == 'on')) ? 'https://' : 'http://'; $scriptFolder .= $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']); return $scriptFolder; } function SendAdminIntimationEmail(&amp;$formvars) { if(empty($this-&gt;admin_email)) { return false; } $mailer = new PHPMailer(); $mailer-&gt;CharSet = 'utf-8'; $mailer-&gt;AddAddress($this-&gt;admin_email); $mailer-&gt;Subject = "New registration: ".$formvars['name']; $mailer-&gt;From = $this-&gt;GetFromAddress(); $mailer-&gt;Body ="A new user registered at ".$this-&gt;sitename." ". "Name: ".$formvars['name']." ". "Email address: ".$formvars['email']." ". "UserName: ".$formvars['username']; if(!$mailer-&gt;Send()) { return false; } return true; } function SaveToDatabase(&amp;$formvars) { if(!$this-&gt;DBLogin()) { $this-&gt;HandleError("Database login failed!"); return false; } if(!$this-&gt;Ensuretable()) { return false; } if(!$this-&gt;IsFieldUnique($formvars,'email')) { $this-&gt;HandleError("This email is already registered"); return false; } if(!$this-&gt;IsFieldUnique($formvars,'username')) { $this-&gt;HandleError("This UserName is already used. Please try another username"); return false; } if(!$this-&gt;InsertIntoDB($formvars)) { $this-&gt;HandleError("Inserting to Database failed!"); return false; } return true; } function IsFieldUnique($formvars,$fieldname) { $field_val = $this-&gt;SanitizeForSQL($formvars[$fieldname]); $qry = "select username from $this-&gt;tablename where $fieldname='".$field_val."'"; $result = mysql_query($qry,$this-&gt;connection); if($result &amp;&amp; mysql_num_rows($result) &gt; 0) { return false; } return true; } function DBLogin() { $this-&gt;connection = mysql_connect($this-&gt;db_host,$this-&gt;username,$this-&gt;pwd); if(!$this-&gt;connection) { $this-&gt;HandleDBError("Database Login failed! Please make sure that the DB login credentials provided are correct"); return false; } if(!mysql_select_db($this-&gt;database, $this-&gt;connection)) { $this-&gt;HandleDBError('Failed to select database: '.$this-&gt;database.' Please make sure that the database name provided is correct'); return false; } if(!mysql_query("SET NAMES 'UTF8'",$this-&gt;connection)) { $this-&gt;HandleDBError('Error setting utf8 encoding'); return false; } return true; } function Ensuretable() { $result = mysql_query("SHOW COLUMNS FROM $this-&gt;tablename"); if(!$result || mysql_num_rows($result) &lt;= 0) { return $this-&gt;CreateTable(); } return true; } function CreateTable() { $qry = "Create Table $this-&gt;tablename (". "id_user INT NOT NULL AUTO_INCREMENT ,". "name VARCHAR( 128 ) NOT NULL ,". "email VARCHAR( 64 ) NOT NULL ,". "phone_number VARCHAR( 16 ) NOT NULL ,". "username VARCHAR( 16 ) NOT NULL ,". "password VARCHAR( 32 ) NOT NULL ,". "confirmcode VARCHAR(32) ,". "PRIMARY KEY ( id_user )". ")"; if(!mysql_query($qry,$this-&gt;connection)) { $this-&gt;HandleDBError("Error creating the table query was $qry"); return false; } return true; } function InsertIntoDB(&amp;$formvars) { $confirmcode = $this-&gt;MakeConfirmationMd5($formvars['email']); $formvars['confirmcode'] = $confirmcode; $insert_query = 'insert into '.$this-&gt;tablename.'( name, email, username, password, confirmcode ) values ( "' . $this-&gt;SanitizeForSQL($formvars['name']) . '", "' . $this-&gt;SanitizeForSQL($formvars['email']) . '", "' . $this-&gt;SanitizeForSQL($formvars['username']) . '", "' . md5($formvars['password']) . '", "' . $confirmcode . '" )'; if(!mysql_query( $insert_query ,$this-&gt;connection)) { $this-&gt;HandleDBError("Error inserting data to the table query:$insert_query"); return false; } return true; } function MakeConfirmationMd5($email) { $randno1 = rand(); $randno2 = rand(); return md5($email.$this-&gt;rand_key.$randno1.''.$randno2); } function SanitizeForSQL($str) { if( function_exists( "mysql_real_escape_string" ) ) { $ret_str = mysql_real_escape_string( $str ); } else { $ret_str = addslashes( $str ); } return $ret_str; } /* Sanitize() function removes any potential threat from the data submitted. Prevents email injections or any other hacker attempts. if $remove_nl is true, newline chracters are removed from the input. */ function Sanitize($str,$remove_nl=true) { $str = $this-&gt;StripSlashes($str); if($remove_nl) { $injections = array('/( +)/i', '/( +)/i', '/(\t+)/i', '/(%0A+)/i', '/(%0D+)/i', '/(%08+)/i', '/(%09+)/i' ); $str = preg_replace($injections,'',$str); } return $str; } function StripSlashes($str) { if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return $str; } } ?&gt; </code></pre> </div>

mkdir():许可Laravel

<div class="post-text" itemprop="text"> <p>I'm running the following script for an image upload in a server and getting the following error while it works perfectly on the localhost. </p> <p><strong>Code</strong></p> <pre><code>$user_id = Auth::id(); $logicpath = 'userdp/' . $user_id . '/'; $pubpath = 'userdp/' . $user_id . '/' . $dpFile; $path = '/userdp/' . $user_id . '/' . $dpFile; if (!file_exists($logicpath)) { mkdir($logicpath, 0777, true); } </code></pre> <p><strong>Error</strong></p> <blockquote> <p>ErrorException in UploadController.php line 605: mkdir(): Permission denied</p> <p>at HandleExceptions-&gt;handleError('2', 'mkdir(): Permission denied', '/var/www/html/laravel/app/Http/Controllers/UploadController.php', '605', array('dp' =&gt; object(UploadedFile), 'ext' =&gt; 'jpg', 'img' =&gt; object(Image), 'mime' =&gt; 'image/jpeg', 'width' =&gt; '200', 'height' =&gt; '200', 'fileSize' =&gt; '17152', 'dpFile' =&gt; 'f12f298ab18d58a59c4ed8a589cd1cdc.jpg', 'user_id' =&gt; '1', 'logicpath' =&gt; 'userdp/1/', 'pubpath' =&gt; 'userdp/1/f12f298ab18d58a59c4ed8a589cd1cdc.jpg', 'path' =&gt; '/userdp/1/f12f298ab18d58a59c4ed8a589cd1cdc.jpg'))</p> </blockquote> <p>I tried <code>chmod 777 public</code> and restarted the server. But it didn't work. </p> </div>

切换数据库中的数据

<div class="post-text" itemprop="text"> <p>I am trying to toggle a switch to set my database status to either a 0 or 1. I am using an ajax request but nothing happens when i try toggle. What am i not doing right?</p> <p>I have included an update but nothing happens and there no errors in my console as well. Am i doing the right thing?</p> <p><strong>Controller</strong></p> <pre><code> public function updateFlag() { if(Request::ajax()) { $auto_reply = Toggle::where('id', Auth::user()-&gt;id)-&gt;first(); if($auto_reply-&gt;status == 0) { $auto_reply-&gt;status = 1; $auto_reply-&gt;save(); } else{ $auto_reply-&gt;status = 0; $auto_reply-&gt;save(); } } } </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;div class="container "&gt; &lt;input checked data-toggle="toggle" data-on="Enabled" data-off="Disabled" name="auto_reply" type="checkbox"&gt; &lt;/div&gt; </code></pre> <p><strong>JS</strong></p> <pre><code>&lt;script&gt; $("[name='auto_reply']").bootstrapSwitch(); $(document).ready(function() { $("[name='auto_reply']").on('switchChange.bootstrapSwitch',function(){ $.ajax({ url: '/admin/dashboard/status/update', method: 'post', success: function(data){ alert("Auto Reply has been Turned On"); }, error: function(){ alert("Auto Reply has failed"); } }); }); }); &lt;/script&gt; </code></pre> <p><strong>Route</strong></p> <pre><code>Route::post('admin/dashboard/status/update', 'StatusController@updateFlag'); </code></pre> <p><strong>Update</strong></p> <pre><code>&lt;script&gt; $(document).ready(function() { $("[name='auto_reply']").on('switchChange.bootstrapSwitch',function(){ $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') } }); $.ajax({ url: '/admin/dashboard/status/update', method: 'post', success: function(data){ alert("Auto Reply has been Turned: "+data.msg); }, error: function(){ alert("Auto Reply has failed"); } }); }); }); &lt;/script&gt; </code></pre> <p><strong>Error log</strong></p> <p>[</p> <pre><code> 2017-11-19 19:48:23] local.ERROR: Non-static method Illuminate\Http\Request::ajax() should not be called statically {"userId":1,"email":"data@gmail.com","exception":"[object] (ErrorException(code: 0): Non-static method Illuminate\\Http\\Request::ajax() should not be called statically at /Users/emmnock/FastFoodOderSystem/app/Http/Controllers/Admin/LoyaltyController.php:70) [stacktrace] #0 /Users/emmnock/FastFoodOderSystem/app/Http/Controllers/Admin/LoyaltyController.php(70): Illuminate\\Foundation\\Bootstrap\\HandleExceptions-&gt;handleError(8192, 'Non-static meth...', '/Users/emmnock/...', 70, Array) #1 [internal function]: App\\Http\\Controllers\\Admin\\LoyaltyController-&gt;updateFlag() #2 /Users/emmnock/FastFoodOderSystem/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array) #3 /Users/emmnock/FastFoodOderSystem/vendor/laravel/framework/src/Illuminate/R outing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller-&gt;callAction('updateFlag', Array) </code></pre> </div>

Php mysql用户评级和评论系统

<div class="post-text" itemprop="text"> <p>I have the below given script for star rating. It is working fine but when i want to use $_GET variable in the processing file it is not taking it.</p> <p>Also i want to use the comments with this script but i can not use $_POST or $_GET in <code>tuto-star-rating.php</code>.</p> <p>I can get <code>$_GET['sid']</code> in <code>index.php</code> but i can not get sid in <code>tuto-start-rating.php</code>. This <code>tuto-start-rating.php</code> is called through JS .</p> <p>In index.php the url is <code>index.php?sid=1</code></p> <p>In <code>tuto-star-rating.php</code> i want to save the restaurant id using $_GET but unable to do that. I tried as below but it is not accepting it is only accepting the number putting directly as you can see in the file code below:</p> <pre><code>$getRest = mysql_real_escape_string($_GET['sid']); $query = $bdd-&gt;execute('INSERT INTO rest_rating (sr_id, media, rate, ip, user) VALUES ('.$getRest.', '.$mediaId.', "'.$rate.'", "'.$ipaddress.'", "'.$user.'")'); // We insert the new rate </code></pre> <p>I need help to integrate comment system with this code using a different form or by integrating in the same.</p> <p><strong>index.php</strong></p> <pre><code>&lt;?php include('comment/dbClass.php'); $bdd = new db(); ?&gt; &lt;style&gt; .no_star { display: inline-block; background: url("comment/star.png") no-repeat; width: 16px; height: 16px } .star { display: inline-block; background: url("comment/star.png") no-repeat; background-position: 0 -16px; width: 16px; height: 16px } .star_hover { display: inline-block; background: url("comment/star.png") no-repeat; background-position: 0 -32px; width: 16px; height: 16px } .star_selected { display: inline-block; background: url("comment/star.png") no-repeat; background-position: 0 -48px; width: 16px; height: 16px } &lt;/style&gt; &lt;?php function starBar($numStar, $mediaId, $starWidth) { // function with arguments: number of stars, media ID, width of the star image global $bdd; $getRest = mysql_real_escape_string($_GET['sid']); $cookie_name = 'tcRatingSystem'.$mediaId; // Set up the cookie name // We get the rate average and number of rate from the database $query = $bdd-&gt;getOne('SELECT round(avg(rate), 2) AS average, count(rate) AS nbrRate, sr_id AS sr_id FROM rest_rating WHERE media='.$mediaId.' and sr_id = "'.$getRest.'"'); $avgCeil = round($query['average'], 0); // round above or below to show how many selected stars we display $getJSON = array('numStar' =&gt; $numStar, 'mediaId' =&gt; $mediaId); // We create a JSON with the number of stars and the media ID $getJSON = json_encode($getJSON); // We create the DIV block with selected stars and unselected stars depending of the rate $starBar = '&lt;div id="'.$mediaId.'"&gt;'; $starBar .= '&lt;div class="'; if( !isset($_COOKIE[$cookie_name]) ) $starBar .= 'star_bar'; $starBar .= '" rel='.$getJSON.' style="width:'.($numStar*$starWidth).'px"&gt;'; for ($i=1; $i&lt;=$numStar; $i++) { $starBar .= '&lt;div class="'; if ($i &lt;= $avgCeil) $starBar .= 'star_selected'; else $starBar .= 'star'; $starBar .= '"&gt;&lt;/div&gt;'; } $starBar .= '&lt;/div&gt;'; $starBar .= '&lt;div class="resultMedia'.$mediaId.'" style="font-size: small; color: grey"&gt;'; // We show the rate score and number of rates if ($query['nbrRate'] == 0) $starBar .= 'Not rated yet'; else $starBar .= 'Rating: ' . $query['average'] . '/' . $numStar . ' (' . $query['nbrRate'] . ' votes)'; $starBar .= '&lt;/div&gt;'; $starBar .= '&lt;div class="box'.$mediaId.'"&gt;&lt;/div&gt;'; // Return the text "Thank you for rating" when someone rate $starBar .= '&lt;/div&gt;'; return $starBar; } echo starBar(5, 59, 16); // We create star bar ?&gt; </code></pre> <p><strong>tuto-start-rating.php</strong></p> <pre><code>&lt;?php session_start(); include('dbClass.php'); $bdd = new db(); //$getRest = mysql_real_escape_string($_GET['sid']); $ipaddress = $_SERVER["REMOTE_ADDR"]; $user = session_id(); if($_POST) { $mediaId = $_POST['mediaId']; // Media ID $rate = $_POST['rate']; // Your rate $expire = 24*3600; // 1 day setcookie('tcRatingSystem'.$mediaId, 'voted', time() + $expire, '/'); // Place a cookie $query = $bdd-&gt;execute('INSERT INTO rest_rating (sr_id, media, rate, ip, user) VALUES (1, '.$mediaId.', "'.$rate.'", "'.$ipaddress.'", "'.$user.'") '); // We insert the new rate // We calculate the new average and new number of rate $result = $bdd-&gt;getOne('SELECT round(avg(rate), 2) AS average, count(rate) AS nbrRate FROM rest_rating WHERE media='.$mediaId.''); $avgCeil = round($result['average'], 0); // Round the average // Send JSON back with the new average, the number of rate and rounded average $dataBack = array('avg' =&gt; $result['average'], 'nbrRate' =&gt; $result['nbrRate'], 'avgCeil' =&gt; $avgCeil); $dataBack = json_encode($dataBack); echo $dataBack; } ?&gt; </code></pre> <p><strong>tuto-star-rating.js</strong></p> <pre><code> function rateMedia(mediaId, rate, numStar) { $('.box' + mediaId).html('&lt;img src="comment/loader-small.gif" alt="" /&gt;'); // Display a processing icon var data = {mediaId: mediaId, rate: rate}; // Create JSON which will be send via Ajax $.ajax({ // JQuery Ajax type: 'POST', url: 'comment/tuto-star-rating.php', // URL to the PHP file which will insert new value in the database data: data, // We send the data string dataType: 'json', timeout: 3000, success: function(data) { $('.box' + mediaId).html('&lt;div style="font-size: small; color: green"&gt;Thank you for rating&lt;/div&gt;'); // Return "Thank you for rating" // We update the rating score and number of rates $('.resultMedia' + mediaId).html('&lt;div style="font-size: small; color: grey"&gt;Rating: ' + data.avg + '/' + numStar + ' (' + data.nbrRate + ' votes)&lt;/div&gt;'); // We recalculate the star bar with new selected stars and unselected stars var ratingBar = ''; for ( var i = 1; i &lt;= numStar; i++ ) { ratingBar += '&lt;div class="'; if (i &lt;= data.avgCeil) ratingBar += 'star_selected'; else ratingBar += 'star'; ratingBar += '"&gt;&lt;/div&gt;'; } $('#' + mediaId + ' .star_bar').html(ratingBar).off('mouseenter'); }, error: function() { $('#box').text('Problem'); } }); } $(function () { $('.star_bar').on('mouseenter', function overBar(event) { // Mouse enter the star bar var relData = $.parseJSON($(this).attr('rel')); // Get JSON values: number of stars and media ID $(this).css('cursor','pointer'); // We create a new star bar OVER the previous one with transparent stars var newStarBar = ''; for ( var i = 1; i &lt;= relData.numStar; i++ ) { newStarBar += '&lt;div class="no_star" id="' + i + '" title="' + i + '/' + relData.numStar + '" onclick="rateMedia(' + relData.mediaId + ', ' + i + ', ' + relData.numStar + '); return false;"&gt;&lt;/div&gt;'; } $(this).css('position', 'relative').append('&lt;div id="over' + relData.mediaId + '" style="position:absolute; top:0; left:0;"&gt;' + newStarBar + '&lt;/div&gt;'); // When we move the mouse over the new transparent star bar they become blue $('#over' + relData.mediaId + ' &gt; div').mouseover(function() { var myRate = $(this).attr('id'); for ( var i = 1; i &lt;= relData.numStar; i++ ) { if (i &lt;= myRate) $('#over' + relData.mediaId + ' #' + i).attr('class', 'star_hover'); else $('#over' + relData.mediaId + ' #' + i).attr('class', 'no_star'); } }); }); // Mouse leaves the star bar, we remove the rating bar $('.star_bar').on('mouseleave', function overBar(event) { var relData = $.parseJSON($(this).attr('rel')); $('#over' + relData.mediaId).remove(); }); }); **tuto-star-rating.php** &lt;?php session_start(); include('dbClass.php'); $bdd = new db(); //$getRest = mysql_real_escape_string($_GET['sid']); $ipaddress = $_SERVER["REMOTE_ADDR"]; $user = session_id(); if($_POST) { $mediaId = $_POST['mediaId']; // Media ID $rate = $_POST['rate']; // Your rate $expire = 24*3600; // 1 day setcookie('tcRatingSystem'.$mediaId, 'voted', time() + $expire, '/'); // Place a cookie $query = $bdd-&gt;execute('INSERT INTO rest_rating (sr_id, media, rate, ip, user) VALUES (1, '.$mediaId.', "'.$rate.'", "'.$ipaddress.'", "'.$user.'") '); // We insert the new rate // We calculate the new average and new number of rate $result = $bdd-&gt;getOne('SELECT round(avg(rate), 2) AS average, count(rate) AS nbrRate FROM rest_rating WHERE media='.$mediaId.''); $avgCeil = round($result['average'], 0); // Round the average // Send JSON back with the new average, the number of rate and rounded average $dataBack = array('avg' =&gt; $result['average'], 'nbrRate' =&gt; $result['nbrRate'], 'avgCeil' =&gt; $avgCeil); $dataBack = json_encode($dataBack); echo $dataBack; } ?&gt; </code></pre> <p><strong>dbClass.php</strong></p> <pre><code>&lt;?php class db { private $conn; private $host; private $user; private $password; private $baseName; private $port; private $Debug; function __construct($params=array()) { $this-&gt;conn = false; $this-&gt;host = 'localhost'; //hostname $this-&gt;user = 'root'; //username $this-&gt;password = ''; //password $this-&gt;baseName = 'lepetit'; //name of your database $this-&gt;port = '3306'; $this-&gt;debug = true; $this-&gt;connect(); } function __destruct() { $this-&gt;disconnect(); } function connect() { if (!$this-&gt;conn) { $this-&gt;conn = mysql_connect($this-&gt;host, $this-&gt;user, $this-&gt;password); mysql_select_db($this-&gt;baseName, $this-&gt;conn); mysql_set_charset('utf8',$this-&gt;conn); if (!$this-&gt;conn) { $this-&gt;status_fatal = true; echo 'Connection BDD failed'; die(); } else { $this-&gt;status_fatal = false; } } return $this-&gt;conn; } function disconnect() { if ($this-&gt;conn) { @pg_close($this-&gt;conn); } } function getOne($query) { // getOne function: when you need to select only 1 line in the database $cnx = $this-&gt;conn; if (!$cnx || $this-&gt;status_fatal) { echo 'GetOne -&gt; Connection BDD failed'; die(); } $cur = @mysql_query($query, $cnx); if ($cur == FALSE) { $errorMessage = @pg_last_error($cnx); $this-&gt;handleError($query, $errorMessage); } else { $this-&gt;Error=FALSE; $this-&gt;BadQuery=""; $tmp = mysql_fetch_array($cur, MYSQL_ASSOC); $return = $tmp; } @mysql_free_result($cur); return $return; } function getAll($query) { // getAll function: when you need to select more than 1 line in the database $cnx = $this-&gt;conn; if (!$cnx || $this-&gt;status_fatal) { echo 'GetAll -&gt; Connection BDD failed'; die(); } mysql_query("SET NAMES 'utf8'"); $cur = mysql_query($query); $return = array(); while($data = mysql_fetch_assoc($cur)) { array_push($return, $data); } return $return; } function execute($query,$use_slave=false) { // execute function: to use INSERT or UPDATE $cnx = $this-&gt;conn; if (!$cnx||$this-&gt;status_fatal) { return null; } $cur = @mysql_query($query, $cnx); if ($cur == FALSE) { $ErrorMessage = @mysql_last_error($cnx); $this-&gt;handleError($query, $ErrorMessage); } else { $this-&gt;Error=FALSE; $this-&gt;BadQuery=""; $this-&gt;NumRows = mysql_affected_rows(); return; } @mysql_free_result($cur); } function handleError($query, $str_erreur) { $this-&gt;Error = TRUE; $this-&gt;BadQuery = $query; if ($this-&gt;Debug) { echo "Query : ".$query."&lt;br&gt;"; echo "Error : ".$str_erreur."&lt;br&gt;"; } } } ?&gt; </code></pre> </div>

phpmailer错误:无法实例化邮件功能

<div class="post-text" itemprop="text"> <p>I am using localhost WAMP server (Windows) for webhosting. I am getting the following error.</p> <blockquote> <p>phpmailer ERROR :Could not instantiate mail function.</p> </blockquote> <p>I have tried many solutions but nothing worked for me. </p> <h3>PHP mailing script</h3> <pre><code> $mailer = new PHPMailer(); $mailer-&gt;IsMAIL(); $mailer-&gt;CharSet = 'utf-8'; $mailer-&gt;AddAddress($formvars['email'],$formvars['name']); $mailer-&gt;Subject = "Your registration with ".$this-&gt;sitename; $mailer-&gt;From = $this-&gt;GetFromAddress(); $confirmcode = $formvars['confirmcode']; $confirm_url = $this-&gt;GetAbsoluteURLFolder().'/confirmreg.php?code='.$confirmcode; $mailer-&gt;Body ="Hello ".$formvars['name']." ". "Thanks for your registration with ".$this-&gt;sitename." ". "Please click the link below to confirm your registration. ". "$confirm_url ". " ". "Regards, ". "Webmaster ". $this-&gt;sitename; if(!$mailer-&gt;Send()) { $this-&gt;HandleError("Failed sending registration confirmation email.".$mailer-&gt;ErrorInfo); //echo "Mailer Error: " . $mailer-&gt;ErrorInfo; return false; } return true; </code></pre> <p>How do I diagnose this error?</p> </div>

如何回显上次上传文件的名称

<div class="post-text" itemprop="text"> <p>I was asked that the output file should only output the name and id of the last person who uploaded a file with a specific name. confusing right? even I am confused. so let me give an example</p> <p>let us say that you have 3 employees registered in your company. lets call them </p> <ol> <li>Pikachu,</li> <li>Raichu and </li> <li>Pichu. </li> </ol> <p>Pikachu has 3 files uploaded in the company, Raichu has 2 files uploaded and Pichu has also 2 files uploaded. The files must also be ordered according to employeename(ASC) and filename(DESC). Mine is already in ordered by. This is my only problem. In this case the output should look like this:</p> <p>*noticed that the employee name and employee id is in the last file uploaded?? does anyone knows how to do that?please i beg you guys to help me out here T-T the task is way too hard and im just a rookie</p> <p>Im thinking of using 2 tables here. table 1 for the employee id and employee name, table 2 for the file name, etc. so i guess this would also involve 2 while clause. i have the idea but i dont know how to mix them all up.</p> <p>my code before I edited it like sir vincent look like this:</p> <pre><code>if ($_SESSION[$fgmembersite-&gt;GetLoginSessionVar()] == 'sa' OR $_SESSION[$fgmembersite-&gt;GetLoginSessionVar()] == 'admin') { $sql= "select * from gmdc_employee where employee_name like '%$search%' AND employee_name like '$listname%'"; } else { $sql = "select b.* from gmdc_user a, gmdc_employee b where a.username = '".$_SESSION[$fgmembersite-&gt;GetLoginSessionVar()]."' AND a.company_id = b.company_id AND b.employee_name like '$listname%' AND b.employee_name like '%$search%'"; } $query = mysql_query("$sql ORDER BY employee_name,confirmation DESC ,file_id DESC,file_date DESC LIMIT $offset,$limit") or die ( mysql_error () ); $result = mysql_query($sql) or die (mysql_error()); $total = mysql_num_rows($result); if(!$result || mysql_num_rows($result) &lt;= 0) { $fgmembersite-&gt;HandleError("No file found."); return false; } while ($row = mysql_fetch_assoc($query)) { $file_id = $row['file_id']; $file_desc = $row['file_description']; $file_date = $row['file_date']; $file_name = $row['file_name']; $file_accs = $row['folder_access']; $file_employee = $row['employee_id']; $file_confir = $row['confirmation']; $file_ename = ucwords($row['employee_name']); $info = pathinfo($file_name); $file_ext = $info['extension']; echo '&lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr class="subone"&gt;&lt;td class="sub" width="100"&gt;'.$file_employee.'&lt;br /&gt; &amp;nbsp;&lt;/td&gt;'; if($_SESSION[$fgmembersite-&gt;GetLoginSessionVar()] == 'sa') { ?&gt; &lt;td class="sub" width="100"&gt; &lt;a href="" onclick = javascript:newPopup('addfile.php?emp= &lt;?php echo $file_employee ?&gt;');&gt;&lt;?php echo$file_ename?&gt;&lt;/a&gt; &lt;br /&gt;&amp;nbsp;&lt;/td&gt; &lt;?php } else { echo '&lt;td class="sub" width="182"&gt;'.$file_ename.'&lt;br /&gt;&amp;nbsp;&lt;/td&gt;'; } echo'&lt;td class="sub" width="218"&gt; &lt;a href="'.$file_accs.$file_name.'" target="_blank" style="text-decoration: underline;"&gt;'.$file_desc.'&lt;/a&gt; &lt;br /&gt;&amp;nbsp;&lt;/td&gt;&lt;td class="sub" width="100"&gt; '.date('M d, Y',mktime(0,0,0,substr($file_date,5,2) ,substr($file_date,8,2),substr($file_date,0,4))).' &lt;br /&gt;&amp;nbsp;&lt;/td&gt;&lt;td class="sub" width="100"&gt;'.$file_confir.' &lt;br /&gt;&amp;nbsp;&lt;/td&gt;'; if($_SESSION[$fgmembersite-&gt;GetLoginSessionVar()] == 'sa') { if($file_confir == 'Pending' OR $file_confir == 'NotApproved') { if(isset($_GET['id'])) { $fgmembersite-&gt;Delete_Db($_GET['id']); } echo '&lt;td class="sub" width="100"&gt; &lt;a href="index.php?id='.$file_id.'"&gt;Delete&lt;/a&gt; &lt;br /&gt;&amp;nbsp;&lt;/td&gt;'; } } else if($_SESSION[$fgmembersite-&gt;GetLoginSessionVar()] == 'admin') { if($file_confir == 'Pending') { if(isset($_GET['yes'])) { $fgmembersite-&gt;UpdateYesDB($_GET['yes']); //echo "&lt;script&gt;location.reload();&lt;/script&gt;"; } else if(isset($_GET['no'])) { $fgmembersite-&gt;UpdateNoDB($_GET['no']); //echo "&lt;script&gt;location.reload();&lt;/script&gt;"; } if (!isset($_GET['offset'])) { $prevoffset = 0; } else { $prevoffset = $_GET['offset']; echo'&lt;td class="sub" width="100"&gt; &lt;a href="index.php?offset='.$prevoffset.'&amp;searchfile='.$search.' &amp;namelist='.$listname.'&amp;yes='.$file_id.'"&gt;Approve&lt;/a&gt; //there's a link here&lt;br /&gt;&lt;br /&gt; &lt;a href="index.php?offset='.$prevoffset.'&amp;searchfile='.$search.' &amp;namelist='.$listname.'&amp;no='.$file_id.'"&gt;NotApprove&lt;/a&gt; //there's a link here &amp;nbsp;&lt;/td&gt; '; } } }?&gt; </code></pre> <p>Just ignore every <code>if($_SESSION[$fgmembersite-&gt;GetLoginSessionVar()] == 'admin')</code> and whatever, this is for different output since my file can be logged into by 3 different users. SA(programmers), admin(the approver of the file uploaded), and user(company). There are TD and TR there as well, I don't know why wont it appear here.</p> <p>output looked like this:</p> <pre><code>employee_id + employee_name + file_name 3 | pichu | file6 3 | pichu | file1 1 | pikachu | file7 1 | pikachu | file4 1 | pikachi | file3 2 | raichu | file8 2 | raichu | file5 2 | raichu | file2 </code></pre> <p>and I want my output to be like this:</p> <pre><code>***OUTPUT*** **employee_id employee_name file_name** 3 pichu file6 file1 1 pikachu file7 file4 file3 2 raichu file5 file2 </code></pre> <p>for example that raichu uploaded another file, the output should now look like this:</p> <p><em><strong>OUTPUT</strong></em></p> <pre><code>**employee_id employee_name file_name** 3 pichu file6 file1 1 pikachu file7 file4 file3 2 raichu file8 file5 file2 </code></pre> </div>

使用Ajax会产生过时的结果

<div class="post-text" itemprop="text"> <p><strong>EDIT</strong></p> <p>My <code>Ajax</code> form gets correct <code>Id</code> to update a content and a <code>replace</code> option. Submitting is by clicking <code>&lt;input type="submit" value="submit!" /&gt;</code>.</p> <p><code>Problem</code>: When I clicked on <code>submit</code> I didn't see any update. Second trial gave the expected result. When I refreshed the page the lost record (first hit was successful) was on spot.</p> <p><strong>Model</strong></p> <pre><code>[Serializable] public abstract class AbstractEntity { public Guid Id { get; set; } public DateTime LastModified { get; set; } } [Serializable] public class Product : AbstractEntity { public Product() { this.Attachments = new HashSet&lt;Attachment&gt;(); } public String Title { get; set; } public String Commentary { get; set; } public DateTime PlacedOn { get; set; } public String User { get; set; } public ICollection&lt;Attachment&gt; Attachments { get; set; } } [Serializable] public class Attachment { public String MimeType { get; set; } public String Description { get; set; } public String Filename { get; set; } } </code></pre> <p><strong>Controller</strong></p> <pre><code>[HandleError] public class ProductController : Controller { private readonly IDocumentSession documentSession; public ProductController(IDocumentSession documentSession) { this.documentSession = documentSession; } public ActionResult ListRecent() { return View(ListAll()); } [Audit, HttpPost] public ActionResult Delete(Guid id) { documentSession.Delete&lt;Product&gt;(documentSession.Load&lt;Product&gt;(id)); documentSession.SaveChanges(); return PartialView("ProductsList", ListAll()); } [Audit, HttpPost] public ActionResult Create(Product product) { if(ModelState.IsValid) { documentSession.Store(product); documentSession.SaveChanges(); } return PartialView("ProductsList", ListAll()); } private IEnumerable&lt;Product&gt; ListAll() { return documentSession.Query&lt;Product&gt;().ToArray(); } } </code></pre> <p><strong>Views ('scriptless')</strong></p> <blockquote> <p>Layout</p> </blockquote> <pre><code>&lt;head&gt; &lt;title&gt;@ViewBag.Title&lt;/title&gt; &lt;link href="@Url.Content("~/Content/stylesheets/normalize.css")" rel="stylesheet" type="text/css" /&gt; &lt;link href="@Url.Content("~/Content/stylesheets/site.core.css")" rel="stylesheet" type="text/css" /&gt; &lt;script src="@Url.Content("~/Scripts/jquery-1.7.2.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="main-wrapper"&gt; &lt;div id="header"&gt;[@Html.ActionLink("List", "ListRecent", "Product")]&lt;/div&gt; &lt;div id="content"&gt;@RenderBody()&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <blockquote> <p>ListRecent.cshtml</p> </blockquote> <pre><code>@model IEnumerable&lt;lamp.DomainLayer.Entities.Product&gt; @{ ViewBag.Title = "ListRecent"; var options = new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "productsList" }; } &lt;h2&gt;List&lt;/h2&gt; @Html.Partial("ProductsList", Model) @using(Ajax.BeginForm("Create", "Product", options)) { &lt;fieldset&gt; &lt;p&gt; &lt;label class="autoWidth"&gt;Title&lt;/label&gt; @Html.Editor("Title") @Html.ValidationMessage("Title") &lt;/p&gt; &lt;p&gt; &lt;label class="autoWidth"&gt;Commentary&lt;/label&gt; @Html.TextArea("Commentary") @Html.ValidationMessage("Commentary") &lt;/p&gt; @* Some fields I have omitted.. *@ &lt;input type="submit" value="submit" /&gt; &lt;input type="reset" value="clear" /&gt; &lt;/fieldset&gt; } </code></pre> <blockquote> <p>ProductsList.cshtml</p> </blockquote> <pre><code>@model IEnumerable&lt;lamp.DomainLayer.Entities.Product&gt; @{ var options = new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "productsList" }; } &lt;div id="productsList"&gt; @foreach(var p in Model) { &lt;div class="productCard"&gt; &lt;p class="title"&gt;&lt;strong&gt;Title&lt;/strong&gt;: @p.Title&lt;/p&gt; &lt;p class="author"&gt;&lt;strong&gt;User&lt;/strong&gt;: @p.User&lt;/p&gt; &lt;p class="date"&gt;&lt;strong&gt;Placed on&lt;/strong&gt;: @idea.PlacedOn.ToShortDateString()&lt;/p&gt; &lt;p class="link"&gt;@Html.ActionLink("details", "Details", "Product")&lt;/p&gt; &lt;p class="link"&gt; @using(Ajax.BeginForm("Delete", "Product", new { id = p.Id }, options)) { &lt;input type="submit" value="you!" /&gt; } &lt;/p&gt; &lt;/div&gt; } &lt;/div&gt; </code></pre> </div>

如何从php脚本中获取响应文本?

<div class="post-text" itemprop="text"> <p>I'm using the fetch API to send data to a PHP script, which in turn processes it and returns a message using the exit() function. I can see this response when i open the developers tool, under the nextwork tab, but i dont know how to access this response in my javascript code. here is my javascript code:</p> <pre><code>fetch(url, { method: 'POST', body: formData, }).then(response =&gt; { if (response.status === 200) { console.log(this.responseText); //this is the property i'm not sure of } }).catch( (error) =&gt; { handleError("you are disconnected"); }); </code></pre> <p>and here is my php code:</p> <pre><code>$comment = $_POST['comment']; $category = $_POST['category']; $id = $_POST['id']; if ($comment &amp;&amp; $category &amp;&amp; $id) { exit("invalid"); } else .... </code></pre> </div>

IE 11 XHR故障

<div class="post-text" itemprop="text"> <p>My company has developed an embeddable javascript video player. Part of the bootstrapping process involves using <code>XMLHttpRequest</code> to fetch a resource from our server. This is a cross-origin request because our video player is embedded on other people's sites via a script tag. We have our CORS headers configured correctly and it working in Chrome, Firefox, Safari, iOS, Android, and others. It also works for me when I test in IE 11 and 10.</p> <p>However, from our analytics data, we are seeing the <code>xhr</code> object raise the <code>error</code> event about 10% of the time in IE 11. I have not been able to reproduce the issue myself.</p> <p>Can anybody think of any reasons why this might be happening? The best theory I have is some kind of corporate IE security settings are blocking our cross-origin request. But that's just wild speculation.</p> <p>Has anybody else ever experienced something like this and found a cause?</p> <p>Here is the code I wrote for making the requests. I don't believe I'm doing anything wrong.</p> <p></p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function makeRequest(config) { var xhr = new window.XMLHttpRequest(); var deferred = q.defer(); var url; function setHeaders(headers) { var header; for (header in headers) { xhr.setRequestHeader(header, headers[header]); } } // toQueryParams() converts an object to URL query params url = config.url + toQueryParams(config.params); /* * This function gets called when the XHR is "loaded". It then fulfills or rejects * the promise based on the HTTP status code of the response. */ function handleResponse() { var response = { status: xhr.status, data: (function() { try { return JSON.parse(xhr.responseText); } catch(e) { return xhr.responseText; } }()), headers: function() { return xhr.getAllResponseHeaders(); } }; var status = response.status, var success = !(status &gt;= 400 &amp;&amp; status &lt; 600); deferred[success ? 'resolve' : 'reject'](response); } /* * This function gets called when the XHR emits an "error". * * There is code elsewhere that sends these errors to our Google Analytics * account. This is how we know about the IE 11 XHR errors even though I * can't reproduce them. */ function handleError() { deferred.reject({ status: null, data: new Error('The XHR request to [' + url + '] has failed...'), headers: function() { return null; } }); } xhr.onload = handleResponse; xhr.onerror = handleError; xhr.open(config.method, url, true); xhr.responseType = config.responseType || ''; setHeaders(config.headers); xhr.timeout = config.timeout || 0; xhr.send(config.data); return deferred.promise; }</code></pre> </div> </div> <p>Thanks for any help you can provide!</p> </div>

如何修复mb_strpos()期望参数1是字符串,给定数组?

<div class="post-text" itemprop="text"> <p>I do the php artisan serve, an error always appears </p> <blockquote> <p>php artisan serve</p> </blockquote> <pre><code>In Str.php line 107: mb_strpos() expects parameter 1 to be string, array given </code></pre> <p>and when I compose the update the same error always appears.</p> <blockquote> <p>composer update</p> </blockquote> <pre><code>Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 0 installs, 3 updates, 0 removals - Updating doctrine/dbal (v2.9.0 =&gt; v2.9.1): Downloading (100%) - Updating opis/closure (3.1.1 =&gt; 3.1.2): Downloading (100%) - Updating laravel/framework (v5.7.17 =&gt; v5.7.18): Downloading (100%) Writing lock file Generating optimized autoload files &gt; Illuminate\Foundation\ComposerScripts::postAutoloadDump &gt; @php artisan package:discover --ansi In Str.php line 107: mb_strpos() expects parameter 1 to be string, array given Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1 </code></pre> <p>when I open the <strong>Str.php</strong> file on line 107 then like this.</p> <pre><code> public static function contains($haystack, $needles) { foreach ((array) $needles as $needle) { if ($needle !== '' &amp;&amp; mb_strpos($haystack, $needle) !== false) { return true; } } return false; } </code></pre> <p>Stacktrace file log laravel:</p> <pre><code>[2018-12-19 09:55:41] local.ERROR: mb_strpos() expects parameter 1 to be string, array given {"exception":"[object] (ErrorException(code: 0): mb_strpos() expects parameter 1 to be string, array given at C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Str.php:107) [stacktrace] #0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions-&gt;handleError(2, 'mb_strpos() exp...', 'C:\\\\xampp-v7.2\\\\h...', 107, Array) #1 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Str.php(107): mb_strpos(Array, '/') #2 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ResourceRegistrar.php(82): Illuminate\\Support\\Str::contains(Array, '/') #3 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\PendingResourceRegistration.php(166): Illuminate\\Routing\\ResourceRegistrar-&gt;register(Array, Object(Closure), Array) #4 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\PendingResourceRegistration.php(178): Illuminate\\Routing\\PendingResourceRegistration-&gt;register() #5 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php(237): Illuminate\\Routing\\PendingResourceRegistration-&gt;__destruct() #6 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\ outes\\web.php(40): Illuminate\\Support\\Facades\\Facade::__callStatic('resource', Array) #7 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(413): Illuminate\\Routing\\Router-&gt;{closure}(Object(Illuminate\\Routing\\Router)) #8 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(373): Illuminate\\Routing\\Router-&gt;loadRoutes(Object(Closure)) #9 </code></pre> </div>

如何检查Guzzle 5的进展情况

<div class="post-text" itemprop="text"> <p>I use Guzzle 5 to get data from api and insert into database. After run this php code I use another ajax call which get's current progress. The problem is that ajax call return value after script finish. So it is always 100%. Is there a way I can get insert progress ?</p> <pre><code> $client = new GuzzleHttp\Client([ 'base_url' =&gt; $domain ]); $params = []; $requests[] = $client-&gt;createRequest('GET', '?' . http_build_query($params)); GuzzleHttp\Pool::send($client, $requests, [ 'pool_size' =&gt; 10, 'complete' =&gt; function (CompleteEvent $event) { $this-&gt;insertData(); } }, 'error' =&gt; function (ErrorEvent $event) { $this-&gt;handleError($error); } ]); </code></pre> <p>It look like database is busy that's why I can't get progress data which I store in database.</p> </div>

Lavel 5.x与Redis Queues生成大量日志

<div class="post-text" itemprop="text"> <p>I have a project that's setup with Laravel and Redis Queues. The application is configured to send push notifications when it receives a message. As soon as message is received, it's stored in the DB and a push is generated:</p> <p><code>dispatch(new CreateMessageNotification($message));</code></p> <p>Project is using Redis queue and Service Provider. The problem is that queue dispatch doesn't work if we don't execute the following command:</p> <p><code>php artisan queue:work redis --daemon</code></p> <p>However, when we do run this command, the application start to generate error logs below. It appears that some routine is stuck somewhere, and we're unable to figure out where, why and how? If we don't run this script, push notifications don't work. If we do run this script, push notifications work with delay, and ERROR logs are produced AND the size of log reaches to GB in a matter of an hour. What are we doing wrong here?</p> <p>We're using Redis/Predis:</p> <pre><code>'redis' =&gt; [ 'client' =&gt; 'predis', 'cluster' =&gt; env('REDIS_CLUSTER', false), 'default' =&gt; [ 'host' =&gt; env('REDIS_HOST', 'localhost'), 'password' =&gt; env('REDIS_PASSWORD', null), 'port' =&gt; env('REDIS_PORT', 6379), 'database' =&gt; env('REDIS_DB', 0), 'timeout' =&gt; 15.0, ], ], </code></pre> <p>For broadcasting, we're using Pusher:</p> <pre><code>'default' =&gt; env('BROADCAST_DRIVER', 'pusher'), </code></pre> <p>For queue, we're using Redis:</p> <pre><code>'default' =&gt; env('QUEUE_DRIVER', 'sync'), QUEUE_DRIVER=redis </code></pre> <p>For cache, we're using Redis:</p> <pre><code>'default' =&gt; env('CACHE_DRIVER', 'file'), CACHE_DRIVER=redis </code></pre> <p><strong>CreateMessageNotification</strong></p> <pre><code>&lt;?php namespace App\Jobs\EventHandlers; use App\Events\Notifications\NewMessageCreatedEvent; use App\Repositories\UserDevicesRepository; use Event; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; class CreateMessageNotification implements ShouldQueue { use InteractsWithQueue, Queueable, SerializesModels; private $message; public function __construct($message) { $this-&gt;message = $message; } public function handle() { Event::fire(new NewMessageCreatedEvent($this-&gt;message)); } } </code></pre> <p><strong>NewMessageCreatedEvent</strong></p> <pre><code>&lt;?php namespace App\Events\Notifications; use App\Models\Chat\Message; use Event; use Illuminate\Queue\SerializesModels; class NewMessageCreatedEvent extends Event { use SerializesModels; public function __construct(Message $message) { $message-&gt;load(['other', 'chat', 'chat.chatUsers']); foreach ($message-&gt;chat-&gt;chatUsers as $chatUser) { if ($chatUser-&gt;user_id !== $message-&gt;other-&gt;id) { Event::fire(new NewMessageNotificationEvent($message, $chatUser-&gt;user_id)); } } } } </code></pre> <p><strong>ERROR LOG</strong></p> <pre><code>[2018-09-06 06:28:55] local.ERROR: exception 'Illuminate\Broadcasting\BroadcastException' with message 'API call failed since (daily) message quota exceeded ' in /var/www/html/project/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:106 Stack trace: #0 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php(49): Illuminate\Broadcasting\Broadcasters\PusherBroadcaster-&gt;broadcast(Array, 'new_$ #1 [internal function]: Illuminate\Broadcasting\BroadcastEvent-&gt;handle(Object(Illuminate\Broadcasting\Broadcasters\PusherBroadcaster)) #2 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(30): call_user_func_array(Array, Array) #3 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #4 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Appli$ #5 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Arr$ #6 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container-&gt;call(Array) #7 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(114): Illuminate\Bus\Dispatcher-&gt;Illuminate\Bus\{closure}(Object(Illuminate\Broadcasting\Broa$ #8 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Pipeline\Pipeline-&gt;Illuminate\Pipeline\{closure}(Object(Illuminate\Broadcast$ #9 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline-&gt;then(Object(Closure)) #10 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(43): Illuminate\Bus\Dispatcher-&gt;dispatchNow(Object(Illuminate\Broadcasting\BroadcastEv$ #11 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(69): Illuminate\Queue\CallQueuedHandler-&gt;call(Object(Illuminate\Queue\Jobs\RedisJob), Array) #12 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(317): Illuminate\Queue\Jobs\Job-&gt;fire() #13 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(267): Illuminate\Queue\Worker-&gt;process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Il$ #14 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(113): Illuminate\Queue\Worker-&gt;runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Ill$ #15 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(102): Illuminate\Queue\Worker-&gt;daemon('redis', 'default', Object(Illuminate\Queue\Wo$ #16 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(86): Illuminate\Queue\Console\WorkCommand-&gt;runWorker('redis', 'default') #17 [internal function]: Illuminate\Queue\Console\WorkCommand-&gt;fire() #18 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(30): call_user_func_array(Array, Array) #19 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #20 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Appl$ #21 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Ar$ #22 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Illuminate\Container\Container-&gt;call(Array) #23 /var/www/html/project/vendor/symfony/console/Command/Command.php(252): Illuminate\Console\Command-&gt;execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\$ #24 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(168): Symfony\Component\Console\Command\Command-&gt;run(Object(Symfony\Component\Console\Input\Ar$ #25 /var/www/html/project/vendor/symfony/console/Application.php(946): Illuminate\Console\Command-&gt;run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\C$ #26 /var/www/html/project/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application-&gt;doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symf$ #27 /var/www/html/project/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application-&gt;doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfon$ #28 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Console\Application-&gt;run(Object(Symfony\Component\Console\In$ #29 /var/www/html/project/artisan(36): Illuminate\Foundation\Console\Kernel-&gt;handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\Conso$ #30 {main} [2018-09-06 06:28:55] local.ERROR: exception 'ErrorException' with message 'Trying to get property of non-object' in /var/www/html/project/app/Events/Notifications/NewMessageCreate$ Stack trace: #0 /var/www/html/project/app/Events/Notifications/NewMessageCreatedEvent.php(27): Illuminate\Foundation\Bootstrap\HandleExceptions-&gt;handleError(8, 'Trying to get p...', '/var/www/h$ #1 /var/www/html/project/app/Jobs/EventHandlers/CreateMessageNotification.php(38): App\Events\Notifications\NewMessageCreatedEvent-&gt;__construct(Object(App\Models\Chat\Message)) #2 [internal function]: App\Jobs\EventHandlers\CreateMessageNotification-&gt;handle() #3 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(30): call_user_func_array(Array, Array) #4 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #5 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Appli$ #6 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Arr$ #7 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container-&gt;call(Array) #8 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(114): Illuminate\Bus\Dispatcher-&gt;Illuminate\Bus\{closure}(Object(App\Jobs\EventHandlers\Creat$ #9 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Pipeline\Pipeline-&gt;Illuminate\Pipeline\{closure}(Object(App\Jobs\EventHandle$ #10 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline-&gt;then(Object(Closure)) #11 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(43): Illuminate\Bus\Dispatcher-&gt;dispatchNow(Object(App\Jobs\EventHandlers\CreateMessag$ #12 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(69): Illuminate\Queue\CallQueuedHandler-&gt;call(Object(Illuminate\Queue\Jobs\RedisJob), Array) #13 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(317): Illuminate\Queue\Jobs\Job-&gt;fire() #14 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(267): Illuminate\Queue\Worker-&gt;process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Il$ #15 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(113): Illuminate\Queue\Worker-&gt;runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Ill$ #16 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(102): Illuminate\Queue\Worker-&gt;daemon('redis', 'default', Object(Illuminate\Queue\Wo$ #17 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(86): Illuminate\Queue\Console\WorkCommand-&gt;runWorker('redis', 'default') #18 [internal function]: Illuminate\Queue\Console\WorkCommand-&gt;fire() #19 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(30): call_user_func_array(Array, Array) #20 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #21 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Appl$ #22 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Ar$ #23 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Illuminate\Container\Container-&gt;call(Array) #24 /var/www/html/project/vendor/symfony/console/Command/Command.php(252): Illuminate\Console\Command-&gt;execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\$ #25 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(168): Symfony\Component\Console\Command\Command-&gt;run(Object(Symfony\Component\Console\Input\Ar$ #26 /var/www/html/project/vendor/symfony/console/Application.php(946): Illuminate\Console\Command-&gt;run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\C$ #27 /var/www/html/project/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application-&gt;doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symf$ #28 /var/www/html/project/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application-&gt;doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfon$ #29 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Console\Application-&gt;run(Object(Symfony\Component\Console\In$ #30 /var/www/html/project/artisan(36): Illuminate\Foundation\Console\Kernel-&gt;handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\Conso$ </code></pre> </div>

初级玩转Linux+Ubuntu(嵌入式开发基础课程)

课程主要面向嵌入式Linux初学者、工程师、学生 主要从一下几方面进行讲解: 1.linux学习路线、基本命令、高级命令 2.shell、vi及vim入门讲解 3.软件安装下载、NFS、Samba、FTP等服务器配置及使用

我以为我对Mysql事务很熟,直到我遇到了阿里面试官

太惨了,面试又被吊打

Python代码实现飞机大战

文章目录经典飞机大战一.游戏设定二.我方飞机三.敌方飞机四.发射子弹五.发放补给包六.主模块 经典飞机大战 源代码以及素材资料(图片,音频)可从下面的github中下载: 飞机大战源代码以及素材资料github项目地址链接 ————————————————————————————————————————————————————————— 不知道大家有没有打过飞机,喜不喜欢打飞机。当我第一次接触这个东西的时候,我的内心是被震撼到的。第一次接触打飞机的时候作者本人是身心愉悦的,因为周边的朋友都在打飞机, 每

Python数据分析与挖掘

92讲视频课+16大项目实战+源码+¥800元课程礼包+讲师社群1V1答疑+社群闭门分享会=99元 &nbsp; 为什么学习数据分析? &nbsp; &nbsp; &nbsp; 人工智能、大数据时代有什么技能是可以运用在各种行业的?数据分析就是。 &nbsp; &nbsp; &nbsp; 从海量数据中获得别人看不见的信息,创业者可以通过数据分析来优化产品,营销人员可以通过数据分析改进营销策略,产品经理可以通过数据分析洞察用户习惯,金融从业者可以通过数据分析规避投资风险,程序员可以通过数据分析进一步挖掘出数据价值,它和编程一样,本质上也是一个工具,通过数据来对现实事物进行分析和识别的能力。不管你从事什么行业,掌握了数据分析能力,往往在其岗位上更有竞争力。 &nbsp;&nbsp; 本课程共包含五大模块: 一、先导篇: 通过分析数据分析师的一天,让学员了解全面了解成为一个数据分析师的所有必修功法,对数据分析师不在迷惑。 &nbsp; 二、基础篇: 围绕Python基础语法介绍、数据预处理、数据可视化以及数据分析与挖掘......这些核心技能模块展开,帮助你快速而全面的掌握和了解成为一个数据分析师的所有必修功法。 &nbsp; 三、数据采集篇: 通过网络爬虫实战解决数据分析的必经之路:数据从何来的问题,讲解常见的爬虫套路并利用三大实战帮助学员扎实数据采集能力,避免没有数据可分析的尴尬。 &nbsp; 四、分析工具篇: 讲解数据分析避不开的科学计算库Numpy、数据分析工具Pandas及常见可视化工具Matplotlib。 &nbsp; 五、算法篇: 算法是数据分析的精华,课程精选10大算法,包括分类、聚类、预测3大类型,每个算法都从原理和案例两个角度学习,让你不仅能用起来,了解原理,还能知道为什么这么做。

如何在虚拟机VM上使用串口

在系统内核开发中,经常会用到串口调试,利用VMware的Virtual Machine更是为调试系统内核如虎添翼。那么怎么搭建串口调试环境呢?因为最近工作涉及到这方面,利用强大的google搜索和自己

程序员的兼职技能课

获取讲师答疑方式: 在付费视频第一节(触摸命令_ALL)片头有二维码及加群流程介绍 限时福利 原价99元,今日仅需39元!购课添加小助手(微信号:csdn590)按提示还可领取价值800元的编程大礼包! 讲师介绍: 苏奕嘉&nbsp;前阿里UC项目工程师 脚本开发平台官方认证满级(六级)开发者。 我将如何教会你通过【定制脚本】赚到你人生的第一桶金? 零基础程序定制脚本开发课程,是完全针对零脚本开发经验的小白而设计,课程内容共分为3大阶段: ①前期将带你掌握Q开发语言和界面交互开发能力; ②中期通过实战来制作有具体需求的定制脚本; ③后期将解锁脚本的更高阶玩法,打通任督二脉; ④应用定制脚本合法赚取额外收入的完整经验分享,带你通过程序定制脚本开发这项副业,赚取到你的第一桶金!

MFC一站式终极全套课程包

该套餐共包含从C小白到C++到MFC的全部课程,整套学下来绝对成为一名C++大牛!!!

C++语言基础视频教程

C++语言基础视频培训课程:本课与主讲者在大学开出的程序设计课程直接对接,准确把握知识点,注重教学视频与实践体系的结合,帮助初学者有效学习。本教程详细介绍C++语言中的封装、数据隐藏、继承、多态的实现等入门知识;主要包括类的声明、对象定义、构造函数和析构函数、运算符重载、继承和派生、多态性实现等。 课程需要有C语言程序设计的基础(可以利用本人开出的《C语言与程序设计》系列课学习)。学习者能够通过实践的方式,学会利用C++语言解决问题,具备进一步学习利用C++开发应用程序的基础。

北京师范大学信息科学与技术学院笔试10复试真题

北京师范大学信息科学与技术学院笔试,可以更好的让你了解北师大该学院的复试内容,获得更好的成绩。

深度学习原理+项目实战+算法详解+主流框架(套餐)

深度学习系列课程从深度学习基础知识点开始讲解一步步进入神经网络的世界再到卷积和递归神经网络,详解各大经典网络架构。实战部分选择当下最火爆深度学习框架PyTorch与Tensorflow/Keras,全程实战演示框架核心使用与建模方法。项目实战部分选择计算机视觉与自然语言处理领域经典项目,从零开始详解算法原理,debug模式逐行代码解读。适合准备就业和转行的同学们加入学习! 建议按照下列课程顺序来进行学习 (1)掌握深度学习必备经典网络架构 (2)深度框架实战方法 (3)计算机视觉与自然语言处理项目实战。(按照课程排列顺序即可)

网络工程师小白入门--【思科CCNA、华为HCNA等网络工程师认证】

本课程适合CCNA或HCNA网络小白同志,高手请绕道,可以直接学习进价课程。通过本预科课程的学习,为学习网络工程师、思科CCNA、华为HCNA这些认证打下坚实的基础! 重要!思科认证2020年2月24日起,已启用新版认证和考试,包括题库都会更新,由于疫情原因,请关注官网和本地考点信息。题库网络上很容易下载到。

Python界面版学生管理系统

前不久上传了一个控制台版本的学生管理系统,这个是Python界面版学生管理系统,这个是使用pycharm开发的一个有界面的学生管理系统,基本的增删改查,里面又演示视频和完整代码,有需要的伙伴可以自行下

软件测试2小时入门

本课程内容系统、全面、简洁、通俗易懂,通过2个多小时的介绍,让大家对软件测试有个系统的理解和认识,具备基本的软件测试理论基础。 主要内容分为5个部分: 1 软件测试概述,了解测试是什么、测试的对象、原则、流程、方法、模型;&nbsp; 2.常用的黑盒测试用例设计方法及示例演示;&nbsp; 3 常用白盒测试用例设计方法及示例演示;&nbsp; 4.自动化测试优缺点、使用范围及示例‘;&nbsp; 5.测试经验谈。

Tomcat服务器下载、安装、配置环境变量教程(超详细)

未经我的允许,请不要转载我的文章,在此郑重声明!!! 请先配置安装好Java的环境,若没有安装,请参照我博客上的步骤进行安装! 安装Java环境教程https://blog.csdn.net/qq_40881680/article/details/83585542 Tomcat部署Web项目(一)·内嵌https://blog.csdn.net/qq_40881680/article/d...

2019数学建模A题高压油管的压力控制 省一论文即代码

2019数学建模A题高压油管的压力控制省一完整论文即详细C++和Matlab代码,希望对同学们有所帮助

图书管理系统(Java + Mysql)我的第一个完全自己做的实训项目

图书管理系统 Java + MySQL 完整实训代码,MVC三层架构组织,包含所有用到的图片资源以及数据库文件,大三上学期实训,注释很详细,按照阿里巴巴Java编程规范编写

linux下利用/proc进行进程树的打印

在linux下利用c语言实现的进程树的打印,主要通过/proc下的目录中的进程文件,获取status中的进程信息内容,然后利用递归实现进程树的打印

微信小程序开发实战之番茄时钟开发

微信小程序番茄时钟视频教程,本课程将带着各位学员开发一个小程序初级实战类项目,针对只看过官方文档而又无从下手的开发者来说,可以作为一个较好的练手项目,对于有小程序开发经验的开发者而言,可以更好加深对小程序各类组件和API 的理解,为更深层次高难度的项目做铺垫。

[已解决]踩过的坑之mysql连接报“Communications link failure”错误

目录 前言 第一种方法: 第二种方法 第三种方法(适用于项目和数据库在同一台服务器) 第四种方法 第五种方法(项目和数据库不在同一台服务器) 总结 前言 先给大家简述一下我的坑吧,(我用的是mysql,至于oracle有没有这样的问题,有心的小伙伴们可以测试一下哈), 在自己做个javaweb测试项目的时候,因为买的是云服务器,所以数据库连接的是用ip地址,用IDE开发好...

人工智能-计算机视觉实战之路(必备算法+深度学习+项目实战)

系列课程主要分为3大阶段:(1)首先掌握计算机视觉必备算法原理,结合Opencv进行学习与练手,通过实际视项目进行案例应用展示。(2)进军当下最火的深度学习进行视觉任务实战,掌握深度学习中必备算法原理与网络模型架构。(3)结合经典深度学习框架与实战项目进行实战,基于真实数据集展开业务分析与建模实战。整体风格通俗易懂,项目驱动学习与就业面试。 建议同学们按照下列顺序来进行学习:1.Python入门视频课程 2.Opencv计算机视觉实战(Python版) 3.深度学习框架-PyTorch实战/人工智能框架实战精讲:Keras项目 4.Python-深度学习-物体检测实战 5.后续实战课程按照自己喜好选择就可以

2019 AI开发者大会

2019 AI开发者大会(AI ProCon 2019)是由中国IT社区CSDN主办的AI技术与产业年度盛会。多年经验淬炼,如今蓄势待发:2019年9月6-7日,大会将有近百位中美顶尖AI专家、知名企业代表以及千余名AI开发者齐聚北京,进行技术解读和产业论证。我们不空谈口号,只谈技术,诚挚邀请AI业内人士一起共铸人工智能新篇章!

机器学习初学者必会的案例精讲

通过六个实际的编码项目,带领同学入门人工智能。这些项目涉及机器学习(回归,分类,聚类),深度学习(神经网络),底层数学算法,Weka数据挖掘,利用Git开源项目实战等。

Python数据分析师-实战系列

系列课程主要包括Python数据分析必备工具包,数据分析案例实战,核心算法实战与企业级数据分析与建模解决方案实战,建议大家按照系列课程阶段顺序进行学习。所有数据集均为企业收集的真实数据集,整体风格以实战为导向,通俗讲解Python数据分析核心技巧与实战解决方案。

YOLOv3目标检测实战系列课程

《YOLOv3目标检测实战系列课程》旨在帮助大家掌握YOLOv3目标检测的训练、原理、源码与网络模型改进方法。 本课程的YOLOv3使用原作darknet(c语言编写),在Ubuntu系统上做项目演示。 本系列课程包括三门课: (1)《YOLOv3目标检测实战:训练自己的数据集》 包括:安装darknet、给自己的数据集打标签、整理自己的数据集、修改配置文件、训练自己的数据集、测试训练出的网络模型、性能统计(mAP计算和画出PR曲线)和先验框聚类。 (2)《YOLOv3目标检测:原理与源码解析》讲解YOLOv1、YOLOv2、YOLOv3的原理、程序流程并解析各层的源码。 (3)《YOLOv3目标检测:网络模型改进方法》讲解YOLOv3的改进方法,包括改进1:不显示指定类别目标的方法 (增加功能) ;改进2:合并BN层到卷积层 (加快推理速度) ; 改进3:使用GIoU指标和损失函数 (提高检测精度) ;改进4:tiny YOLOv3 (简化网络模型)并介绍 AlexeyAB/darknet项目。

2021考研数学张宇基础30讲.pdf

张宇:博士,全国著名考研数学辅导专家,教育部“国家精品课程建设骨干教师”,全国畅销书《张宇高等数学18讲》《张宇线性代数9讲》《张宇概率论与数理统计9讲》《张宇考研数学题源探析经典1000题》《张宇考

三个项目玩转深度学习(附1G源码)

从事大数据与人工智能开发与实践约十年,钱老师亲自见证了大数据行业的发展与人工智能的从冷到热。事实证明,计算机技术的发展,算力突破,海量数据,机器人技术等,开启了第四次工业革命的序章。深度学习图像分类一直是人工智能的经典任务,是智慧零售、安防、无人驾驶等机器视觉应用领域的核心技术之一,掌握图像分类技术是机器视觉学习的重中之重。针对现有线上学习的特点与实际需求,我们开发了人工智能案例实战系列课程。打造:以项目案例实践为驱动的课程学习方式,覆盖了智能零售,智慧交通等常见领域,通过基础学习、项目案例实践、社群答疑,三维立体的方式,打造最好的学习效果。

DirectX修复工具V4.0增强版

DirectX修复工具(DirectX Repair)是一款系统级工具软件,简便易用。本程序为绿色版,无需安装,可直接运行。 本程序的主要功能是检测当前系统的DirectX状态,如果发现异常则进行修复

期末考试评分标准的数学模型

大学期末考试与高中的考试存在很大的不同之处,大学的期末考试成绩是主要分为两个部分:平时成绩和期末考试成绩。平时成绩和期末考试成绩总分一般为一百分,然而平时成绩与期末考试成绩所占的比例不同会导致出现不同

Vue.js 2.0之全家桶系列视频课程

基于新的Vue.js 2.3版本, 目前新全的Vue.js教学视频,让你少走弯路,直达技术前沿! 1. 包含Vue.js全家桶(vue.js、vue-router、axios、vuex、vue-cli、webpack、ElementUI等) 2. 采用笔记+代码案例的形式讲解,通俗易懂

c语言项目开发实例

十个c语言案例 (1)贪吃蛇 (2)五子棋游戏 (3)电话薄管理系统 (4)计算器 (5)万年历 (6)电子表 (7)客户端和服务器通信 (8)潜艇大战游戏 (9)鼠标器程序 (10)手机通讯录系统

董付国老师Python全栈学习优惠套餐

购买套餐的朋友可以关注微信公众号“Python小屋”,上传付款截图,然后领取董老师任意图书1本。

2019全国大学生数学建模竞赛C题原版优秀论文

2019全国大学生数学建模竞赛C题原版优秀论文,PDF原版论文,不是图片合成的,是可编辑的文字版。共三篇。 C044.pdf C137.pdf C308.pdf

Git 实用技巧

这几年越来越多的开发团队使用了Git,掌握Git的使用已经越来越重要,已经是一个开发者必备的一项技能;但很多人在刚开始学习Git的时候会遇到很多疑问,比如之前使用过SVN的开发者想不通Git提交代码为什么需要先commit然后再去push,而不是一条命令一次性搞定; 更多的开发者对Git已经入门,不过在遇到一些代码冲突、需要恢复Git代码时候就不知所措,这个时候哪些对 Git掌握得比较好的少数人,就像团队中的神一样,在队友遇到 Git 相关的问题的时候用各种流利的操作来帮助队友于水火。 我去年刚加入新团队,发现一些同事对Git的常规操作没太大问题,但对Git的理解还是比较生疏,比如说分支和分支之间的关联关系、合并代码时候的冲突解决、提交代码前未拉取新代码导致冲突问题的处理等,我在协助处理这些问题的时候也记录各种问题的解决办法,希望整理后通过教程帮助到更多对Git操作进阶的开发者。 本期教程学习方法分为“掌握基础——稳步进阶——熟悉协作”三个层次。从掌握基础的 Git的推送和拉取开始,以案例进行演示,分析每一个步骤的操作方式和原理,从理解Git 工具的操作到学会代码存储结构、演示不同场景下Git遇到问题的不同处理方案。循序渐进让同学们掌握Git工具在团队协作中的整体协作流程。 在教程中会通过大量案例进行分析,案例会模拟在工作中遇到的问题,从最基础的代码提交和拉取、代码冲突解决、代码仓库的数据维护、Git服务端搭建等。为了让同学们容易理解,对Git简单易懂,文章中详细记录了详细的操作步骤,提供大量演示截图和解析。在教程的最后部分,会从提升团队整体效率的角度对Git工具进行讲解,包括规范操作、Gitlab的搭建、钩子事件的应用等。 为了让同学们可以利用碎片化时间来灵活学习,在教程文章中大程度降低了上下文的依赖,让大家可以在工作之余进行学习与实战,并同时掌握里面涉及的Git不常见操作的相关知识,理解Git工具在工作遇到的问题解决思路和方法,相信一定会对大家的前端技能进阶大有帮助。

linux“开发工具三剑客”速成攻略

工欲善其事,必先利其器。Vim+Git+Makefile是Linux环境下嵌入式开发常用的工具。本专题主要面向初次接触Linux的新手,熟练掌握工作中常用的工具,在以后的学习和工作中提高效率。

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

相关热词 c#框体中的退出函数 c# 按钮透明背景 c# idl 混编出错 c#在位置0处没有任何行 c# 循环给数组插入数据 c# 多线程死锁的例子 c# 钉钉读取员工排班 c# label 不显示 c#裁剪影像 c#工作进程更新ui
立即提问