本文整理汇总了PHP中set_charset函数的典型用法代码示例。如果您正苦于以下问题:PHP set_charset函数的具体用法?PHP set_charset怎么用?PHP set_charset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_charset函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connect
/**
* Connect to the database.
* Note: Currently only MariaDB supported.
*
* @global mysqli
* @param type $vendor
* @param type $host
* @param type $user
* @param type $password
* @param type $dbname
* @return boolean
*/
public function connect($vendor, $host, $user, $password, $dbname)
{
if ($vendor == $this->MARIADB) {
$this->db = new mysqli($host, $user, $password, $dbname);
if ($this->db->connect_errno) {
return $this->db->connect_errno;
}
}
if (!$this->db - set_charset("utf8")) {
return $this->db->error;
}
return null;
}
示例2: set_charset
<?php
include_once '../frame.php';
$user = User::current_user();
set_charset("utf-8");
if (!$user) {
alert("请您先登录!");
?>
<script>window.location.href="/login/";</script>
<?php
}
$resos_id = $_POST["resos_id"];
if (!is_numeric($resos_id)) {
die('invlid request!');
}
$db = get_db();
$db->execute("delete from eachbb_member.comment where resource_id={$resos_id} and resource_type='photo'");
$resutl = $db->query("SELECT photo,album_id FROM eachbb_member.photo p where id={$resos_id};");
$result = $resutl[0]->photo;
$resource_id = $resutl[0]->album_id;
#echo $result;
#var_dump("../"substr($result,1));
if (!$db->execute("delete from eachbb_member.photo where id=" . $resos_id)) {
die("删除失败!");
} else {
$db->execute("insert into `eachbb_member`.lastest_news (resource_id,resource_type,u_id,created_at,u_name,u_avatar,form)values('{$resource_id}','image','{$user->id}',now(),'{$user->name}','{$user->avatar}','删除了一张照片:')");
echo "删除成功!";
}
if (is_file(".." . $result)) {
@unlink(".." . $result);
} else {
示例3: intval
<?php
include_once '../frame.php';
include_once '../inc/user.class.php';
$news_id = intval($_POST['news_id']);
$news = new table_class('eb_category');
$news->find($news_id);
if (!$news->id) {
die('invalid param');
}
$len = count($_POST['mail']);
set_charset();
$news_share = new table_class('eb_news_share');
$user = User::current_user();
echo $user->password;
if (!$user) {
die('need login');
}
for ($i = 0; $i < $len; $i++) {
if (empty($_POST['mail'][$i])) {
continue;
}
if (!check_email($_POST['mail'][$i])) {
die($_POST['mail'][$i] . " 格式不正确");
}
$news_share->id = 0;
$news_share->user = $user->name;
$news_share->nick_name = htmlspecialchars($_POST['name'][$i]);
$news_share->email = htmlspecialchars($_POST['mail'][$i]);
$news_share->created_at = now();
$news_share->news_id = $news_id;
示例4: set_charset
if (!is_numeric($svg_scalingfactor)) {
$svg_scalingfactor = 1.0;
}
if (!is_numeric($svg_scalingfactor_rxn)) {
$svg_scalingfactor_rxn = 0.75;
}
if (strpos($mol2svgopt, '--scaling=') === FALSE) {
$mol2svgopt .= " --scaling={$svg_scalingfactor}";
}
if (strpos($mol2svgopt_rxn, '--scaling=') === FALSE) {
$mol2svgopt_rxn .= " --scaling={$svg_scalingfactor_rxn}";
}
if (config_quickcheck() > 0) {
die;
}
set_charset($charset);
if (!isset($sitename) || $sitename == "") {
$sitename = "Sristi Biosciences";
}
@($db_id = $_REQUEST['db']);
@($datatype = $_REQUEST['datatype']);
@($action = $_REQUEST['action']);
@($smiles = $_POST['smiles']);
@($jme = $_POST['jme']);
@($mol = $_POST['mol']);
@($clrmaps = $_POST['clr']);
$ostype = getostype();
// new in Jan 2014 edition: choice of structure editors
@($curr_settings = $_COOKIE["MolDB6"]);
$curr_a = explode(",", $curr_settings);
foreach ($curr_a as $curr_line) {
示例5: get_db
<?php
include_once '../frame.php';
$photo = $_POST["photo"];
$db = get_db();
set_charset("UTF-8");
$user = User::current_user();
if (!$user) {
die("请先登录!");
}
if (!$photo) {
die("非法操作!");
}
$sql = "insert into eachbb_member.album(u_id,name,created_at,last_update_time,visit_count,comment_count)values('{$user->id}','{$photo}',now(),now(),0,0);";
$resource_id = "select id from eachbb_member.album where u_id = '{$user->id}' order by created_at desc limit 1";
$resource_id = $resource_id[0]->id;
echo $resource_id;
if ($db->execute($sql)) {
if ($db->execute("insert into `eachbb_member`.lastest_news (resource_id,resource_type,u_id,created_at,u_name,u_avatar,form,photo)values('{$resource_id}','image','{$user->id}',now(),'{$user->name}','{$user->avatar}','添加了新相册:','{$photo}')")) {
echo "添加相册成功!";
}
} else {
echo "添加相册失败!";
}
示例6: dirname
<?php
include_once dirname(__FILE__) . './../frame.php';
set_charset('utf-8');
js_include_tag('swfobject', 'public_top');
use_jquery_ui();
?>
<style>
#top_login{
width:970px;
height:103px;
}
#tl_l{
width:227px;
background:url('/images/top/logo.png') no-repeat;
float:left;
}
#tl_r{
width:702px;
height:103px;
background:none;
float:right;
display:inline;
}
#tl_r_l{
width:22px;
height:82px;
background:url('/images/top/t_l.jpg') no-repeat;
float:left;
}
#tl_r_r{