an94er

第 400 位会员

会员
个人信息
  • 加入于 2018-03-20 16:10:42
  • 最后登录时间 4个月前
个人成就
  • 发表文章次数 12
  • 发布回复次数 14
  • 个人主页浏览次数 7
想调用发邮件,结果报错:Swift_TransportException Connection could not be established with host smtp.qq.com [php_network_getaddresses: getaddrinfo failed: Name or service not known #0]6个月前

还有,我自己写的发邮件方式也是报这个错,用的163发,在我本机可以发,但是上服务器就会报这个标题一样的错,感觉应该是某个配置有问题,附上自定义代码:

<?php

class Mailer
{
  private $host;
  private $port = 25;
  private $user;
  private $pass;
  private $debug = false;
  private $sock;
 
  public function __construct($host,$port,$user,$pass,$debug = false)
  {
    $this->host = $host;
    $this->port = $port;
    $this->user = base64_encode($user); //用户名密码一定要使用base64编码才行
    $this->pass = base64_encode($pass);
    $this->debug = $debug;
  //socket连接
    $this->sock = fsockopen($this->host,$this->port);
    if(!$this->sock){
      exit('出错啦');
    }
  //读取smtp服务返回给我们的数据
    $response = fgets($this->sock);
    $this->debug($response);
        //如果响应中有220返回码,说明我们连接成功了
    if(strstr($response,'220') === false){
      exit('出错啦');
    }
  }
//发送SMTP指令,不同指令的返回码可能不同
  public function execCommand($cmd,$return_code){
    fwrite($this->sock,$cmd);
 
    $response = fgets($this->sock);
//输出调试信息
    $this->debug('cmd:'.$cmd .';response:'.$response);
    if(strstr($response,$return_code) === false){
      return false;
    }
    return true;
  }
 
  public function sendMail($from,$to,$subject,$body){
//detail是邮件的内容,一定要严格按照下面的格式,这是协议规定的
    $detail = 'From:'.$from."\r\n";
    $detail .= 'To:'.$to."\r\n";
    $detail .= 'Subject:'.$subject."\r\n";
    $detail .= 'Content-Type: Text/html;'."\r\n";
    $detail .= 'charset=gb2312'."\r\n\r\n";
    $detail .= $body;
    $this->execCommand("HELO ".$this->host."\r\n",250);
    $this->execCommand("AUTH LOGIN\r\n",334);
    $this->execCommand($this->user."\r\n",334);
    $this->execCommand($this->pass."\r\n",235);
    $this->execCommand("MAIL FROM:<".$from.">\r\n",250);
    $this->execCommand("RCPT TO:<".$to.">\r\n",250);
    $this->execCommand("DATA\r\n",354);
    $this->execCommand($detail."\r\n.\r\n",250);
    $this->execCommand("QUIT\r\n",221);
  }
 
  public function debug($message){
    if($this->debug){
      echo '<p>Debug:'.$message . PHP_EOL .'</p>';
    }
  }
 
  public function __destruct()
  {
    fclose($this->sock);
  }
 
}



$port = 25;
$user = ''; //请替换成你自己的smtp用户名
$pass = ''; //请替换成你自己的smtp密码
$host = 'smtp.163.com';
$from = 'an94er@163.com'; 
$to = 'an94er@live.com';

$body = $_GET["body"];;
$subjet = '购买下单';
$mailer = new Mailer($host,$port,$user,$pass,true);
$mailer->sendMail($from,$to,$subjet,$body);


?>

只需要改下 $user = ''; //请替换成你自己的smtp用户名 $pass = ''; //请替换成你自己的smtp密码 就可以直接用了的,本机可以,服务器不行

想在代码里面执行exec(),shell_exec()等linux命令,结果没有任何反应6个月前

1.你需要进入容器查看:docker-compose exec php bash,进去搜索了,没有找到的,find / -name 1.log没有找到

2.作映射,这是建立在docker容器里面有的情况才能映射出来吧,但是限制容器里面都没有呢

想调用发邮件,结果报错:Swift_TransportException Connection could not be established with host smtp.qq.com [php_network_getaddresses: getaddrinfo failed: Name or service not known #0]6个月前

你说的smtp失效,指的是:app/fecshop/common/config/fecshop_local_services/Email.php这里的配置吧,我取qq邮箱哪里开启了吧,配置如下图: 改了没用,报错是一样的

mongo里面的首页跑马灯数据只有五张图片,但是首页跑马灯出来有七张图,后面两张是空白6个月前

谢谢版主的回复,我一开始改的就是后台cms static block,里面只有五张的,这个bug产生的原因也是因为这个 里面代码如下: ···

<div class="container">          
	<div class="row">            
		<div class="span12">              
			<div id="owl-fecshop" class="owl-carousel">                
				<div class="item">
					<a href="#"><img class="lazyOwl" data-src="{{imgBaseUrl}}/home/images/upload/loop_pic/1.jpg" alt="" /></a>
				</div>                
				<div class="item">
					<a href="#"><img class="lazyOwl" data-src="{{imgBaseUrl}}/home/images/upload/loop_pic/2.jpg" alt="" /></a>
				</div>                
				<div class="item">
					<a href="#"><img class="lazyOwl" data-src="{{imgBaseUrl}}/home/images/upload/loop_pic/3.jpg" alt="" /></a>
				</div>              
				<div class="item">
					<a href="#"><img class="lazyOwl" data-src="{{imgBaseUrl}}/home/images/upload/loop_pic/4.jpg" alt="" /></a>
				</div>  
				<div class="item">
					<a href="#"><img class="lazyOwl" data-src="{{imgBaseUrl}}/home/images/upload/loop_pic/5.jpg" alt="" /></a>
				</div>  
			</div>            
		</div>          
	</div>        
</div>    

···
分享个自己写的批量插入产品的脚本6个月前

我擦,真没注意:joy:,被自己蠢哭。。

分享个自己写的批量插入产品的脚本6个月前

我这是真没有的啦~

修改默认语言为法语之后,主页菜单栏鼠标滑过时出现的分类就没有了6个月前

1.看了,法语下name字段是没有值的, 2.但是我在用api新增分类时是提交了 "name": {

    "name_en": "Wedding666",
    "name_fr": "weding",
    "name_zh": "婚礼"
}

结果取后台看法语下还是没有分类名字,是不是api不支持其它语言只支持英文呢

分享个自己写的批量插入产品的脚本6个月前

这个帖子类型我改不了,没有这个选项,应该是没权限

我部署的服务器除了appapi.xxx.com这个域名报错无法访问,其它类似appfront,apphtml5等都可以访问6个月前

terry,还有个问题,批量上传数据是没问题了,但是图片放哪呢, 我放在app/fecshop/appimage/common/media/catalog/product/下面,新建了一个images文件夹里面放图片,然后mongo里面的image,用相对路径230images/20140908/0305/sh145-6397-5395.jpg,但是页面在加载的时候报错 (/www/web/fecshop/appimage/common/media/catalog/product/cache/bd935443df1c50537d4edaab4af5d446/230/230images/20140908/0305/sh145-6397-5395.jpg): failed to open stream: No such file or directory 怎么加载到cache/bd935443df1c50537d4edaab4af5d446/230/230里面去了呢

这跟导入数是一个问题,应该不用发新帖吧

项目从product调整成dev,然后pc访问出现yii\base\InvalidValueException config key: 'beforeContent', can not find in Yii::$service->page->widget->widgetConfig, you must config it before use it.6个月前

问题已经解决,解决办法如下: 直接在php的容器里面 删除旧版本然后升级成Fecshop 1.4.3.2,当前操作时最新版,已经可以正常访问了 不知为啥,按照 http://www.fecshop.com/doc/fecshop-guide/develop/cn-1.0/guide-fecshop-about-update.html 这里真更新不了,原因有空再研究了

至于markdown,我已经整理好,不对请指正 最后感谢群主,不说了,先去群里发红包:smile:

项目从product调整成dev,然后pc访问出现yii\base\InvalidValueException config key: 'beforeContent', can not find in Yii::$service->page->widget->widgetConfig, you must config it before use it.6个月前

用这个composer selfupdate先也不行啊,无法升级。。。

root@08c0591a2aa2:/www/web/fecshop# composer selfupdate You are already using composer version 1.6.5 (stable channel). root@08c0591a2aa2:/www/web/fecshop# composer update Do not run Composer as root/super user! See https://getcomposer.org/root for details The "extra.asset-installer-paths" option is deprecated, use the "config.fxp-asset.installer-paths" option Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update
Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead. Generating autoload files

项目从product调整成dev,然后pc访问出现yii\base\InvalidValueException config key: 'beforeContent', can not find in Yii::$service->page->widget->widgetConfig, you must config it before use it.6个月前

@fecshop 是不是参考升级教程,改了版本号,然后在docker容器里面进行升级的呢,我的是在php容器里面进行composer update,结果: Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update
Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead. Writing lock file Generating autoload files 貌似升级失败了

Your Site Analytics