23 сентября 2014
1 комментарий
Аналог header(‘Location: ‘.$arResult[‘ITEMS’][0][‘DETAIL_PAGE_URL’])
localredirect($arResult['ITEMS'][0]['DETAIL_PAGE_URL'],false,"301 Moved permanently");
Аналог header(‘Location: ‘.$arResult[‘ITEMS’][0][‘DETAIL_PAGE_URL’])
localredirect($arResult['ITEMS'][0]['DETAIL_PAGE_URL'],false,"301 Moved permanently");
Вернет только уникальные массивы из многомерного.
$objects=array_map("unserialize",array_unique(array_map("serialize",$objects)));
http://webtypo.blogspot.ru/2012/11/arrayunique.html
require "FGetCSV.php"; $content=file_get_contents($f); if(($handle=fopen("php://memory","r+"))!==FALSE){ fputs($handle,$content); rewind($handle); while($data=File_FGetCSV::fgetcsv($handle,65536,";")) { print_r($data); } }
Скачать: FGetCSV
http://forum.dklab.ru/viewtopic.php?p=200945
$abc=array(); $range=range(192,223); foreach($range as $letter) { $abc[]=chr($letter); } print_r($abc);
http://www.kobzarev.com/programming/print-cyrillic-alphabet.html
$abc=array(); foreach(range(chr(0xC0),chr(0xDF)) as $letter) { $abc[]=iconv('CP1251','UTF-8',$letter); } print_r($abc);
http://www.kobzarev.com/programming/print-cyrillic-alphabet.html
javascript:
$(document).ready(function(){ var session; var secpic=document.getElementById('secpic'); $.ajaxSetup({cache:false}) $.get('gs.php',{requested:'captcha'},function (data) { session=data; secpic.value=$.trim(session); }); });
php:
session_start(); if (isset($_GET['requested'])) { print $_SESSION[$_GET['requested']]; } else { print json_encode($_SESSION); }
html:
<input type="hidden" id="secpic" name="secpic" value=""/>
http://stackoverflow.com/questions/2765175/how-to-get-session-variables-from-php-server-with-ajax-function-php-html-js-aj
Отправляя
header("HTTP/1.0 404 Not Found"); exit();
в .htaccess
ErrorDocument 404 /404.php
работать не будет.
Можно отправлять заголовок
header("Location:/404.php");
но тогда ответ будет HTTP/1.1 302 Moved Temporarily
Решение: содержимое файла 404.php переносим в функцию
function Print404() { echo '<h1>404</h1><a href="/">back</a>'; }
и в коде:
header("HTTP/1.0 404 Not Found"); Print404(); exit();