小编gob*_*lar的帖子

.htaccess页面和lang错误

我试着看看stackoverflow但我找不到我的答案.

所以我需要找出哪个域是用户是哪个子域以及正在加载哪个页面.

例如:en.domain.com/contactus

这应该加载英文联系我们页面.

我拥有的是:

RewriteCond %{HTTP_HOST} ^(www\.)?domain.com$ [NC]
RewriteRule ^(.*)$ index.php?lang=en&page=$1 [L,NC]

RewriteCond %{HTTP_HOST} ^en.domain.com$ [NC]
RewriteRule ^(.*)$ index.php?lang=en&page=$1 [L,NC]
RewriteCond %{HTTP_HOST} ^fr.domain.com$ [NC]
RewriteRule ^(.*)$ index.php?lang=fr&page=$1 [L,NC]
#etc...
Run Code Online (Sandbox Code Playgroud)

但由于某些原因,当我回显get for page时,值为:index.php所以我无法读取页面.

apache .htaccess mod-rewrite

17
推荐指数
1
解决办法
198
查看次数

php vcard显示为纯文本

我的网站上有一个新功能,允许用户获取vcard文件.此功能从我的数据库(这个工作)读取数据并生成vcard.

该文件是:vcard.php,我将用户ID传递为GET

然后我使用该ID获取所有信息

我的问题是当我想要获得vcard时,它显示为文本.这是我的代码的简化版本:

<?php

class Vcard {

  public function __construct() {
    $this->props = array();
  }

  public function setName($family, $first) {
    $name = $family . ';' . $first . ';';
    $this->props['N'] = $name;
    if(!isset($this->props['FN'])) {
      $display = $first . ' ';
      $display .= $family;
      $this->props['FN'] = trim($name);
    }
  }
  /* and all the rest of my props */
  public function get() {
    $text = 'BEGIN:VCARD' . "\r\n";
    $text.= 'VERSION:2.1' . "\r\n";
    foreach($this->props as $key => $value) {
      $text .= $key …
Run Code Online (Sandbox Code Playgroud)

php vcf-vcard

15
推荐指数
1
解决办法
1349
查看次数

标签 统计

.htaccess ×1

apache ×1

mod-rewrite ×1

php ×1

vcf-vcard ×1